Add single type formatting

This commit is contained in:
dmex
2024-09-09 06:27:08 +10:00
parent eb58b5200a
commit 0c0c938f88
46 changed files with 600 additions and 400 deletions
+4 -1
View File
@@ -1792,7 +1792,10 @@ VOID PhApplyTreeNewFilters(
}
}
TreeNew_NodesStructured(Support->TreeNewHandle);
if (Support->NodeList->Count)
{
TreeNew_NodesStructured(Support->TreeNewHandle);
}
}
VOID NTAPI PhpCopyCellEMenuItemDeleteFunction(
+3 -1
View File
@@ -298,6 +298,7 @@ typedef struct _PH_PROCESS_ITEM
FLOAT ImageCoherency;
ULONG LxssProcessId;
HANDLE FreezeHandle;
} PH_PROCESS_ITEM, *PPH_PROCESS_ITEM;
// end_phapppub
@@ -523,11 +524,12 @@ PhGetProcessSmallImageList(
);
// Note: Can only be called from same thread as process provider. (dmex)
_Success_(return)
PHAPPAPI
BOOLEAN
NTAPI
PhDuplicateProcessInformation(
_Out_ PPVOID ProcessInformation
_Outptr_ PPVOID ProcessInformation
);
// end_phapppub
+8 -8
View File
@@ -468,8 +468,8 @@ VOID PhMwpInitializeControls(
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | TCS_MULTILINE,
0,
0,
3,
3,
0,
0,
WindowHandle,
NULL,
PhInstanceHandle,
@@ -482,8 +482,8 @@ VOID PhMwpInitializeControls(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | TN_STYLE_ANIMATE_DIVIDER | thinRows | treelistBorder | treelistCustomColors | treelistCustomHeaderDraw,
0,
0,
3,
3,
0,
0,
WindowHandle,
NULL,
PhInstanceHandle,
@@ -496,8 +496,8 @@ VOID PhMwpInitializeControls(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | thinRows | treelistBorder | treelistCustomColors,
0,
0,
3,
3,
0,
0,
WindowHandle,
NULL,
PhInstanceHandle,
@@ -510,8 +510,8 @@ VOID PhMwpInitializeControls(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | thinRows | treelistBorder | treelistCustomColors,
0,
0,
3,
3,
0,
0,
WindowHandle,
NULL,
PhInstanceHandle,
+1 -1
View File
@@ -770,7 +770,7 @@ VOID PhMwpInitializeProcessMenu(
if (WindowsVersion >= WINDOWS_11 && PH_IS_REAL_PROCESS_ID(Processes[0]->ProcessId))
{
if (PhIsProcessStateFrozen(Processes[0]->ProcessId))
if (!PhIsNullOrInvalidHandle(Processes[0]->FreezeHandle))
{
if (item = PhFindEMenuItem(Menu, 0, NULL, ID_PROCESS_FREEZE))
PhDestroyEMenuItem(item);
+6 -4
View File
@@ -197,9 +197,9 @@ VOID PhLoadSettingsNetworkTreeList(
PhDereferenceObject(sortSettings);
if (PhGetIntegerSetting(L"EnableInstantTooltips"))
{
SendMessage(TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_INITIAL, 0);
}
else
SendMessage(TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT);
PhLoadSettingsNetworkTreeUpdateMask();
}
@@ -222,8 +222,10 @@ VOID PhReloadSettingsNetworkTreeList(
VOID
)
{
SendMessage(TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_INITIAL,
PhGetIntegerSetting(L"EnableInstantTooltips") ? 0 : -1);
if (PhGetIntegerSetting(L"EnableInstantTooltips"))
SendMessage(TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_INITIAL, 0);
else
SendMessage(TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT);
PhLoadSettingsNetworkTreeUpdateMask();
}
+2 -2
View File
@@ -1983,7 +1983,7 @@ VOID PhNfpCpuUsageIconUpdateCallback(
}
PhInitFormatS(&format[0], L"CPU usage: ");
PhInitFormatF(&format[1], (PhCpuKernelUsage + PhCpuUserUsage) * 100.f, PhMaxPrecisionUnit);
PhInitFormatF(&format[1], (PhCpuKernelUsage + PhCpuUserUsage) * 100, PhMaxPrecisionUnit);
PhInitFormatC(&format[2], L'%');
if (maxCpuText) PhInitFormatSR(&format[3], maxCpuText->sr);
else PhInitFormatC(&format[3], L' ');
@@ -2077,7 +2077,7 @@ VOID PhNfpCpuUsageTextIconUpdateCallback(
}
PhInitFormatS(&format[0], L"CPU usage: ");
PhInitFormatF(&format[1], (PhCpuKernelUsage + PhCpuUserUsage) * 100, PhMaxPrecisionUnit);
PhInitFormatF(&format[1], (PhCpuKernelUsage + PhCpuUserUsage) * 100.f, PhMaxPrecisionUnit);
PhInitFormatC(&format[2], L'%');
if (maxCpuText) PhInitFormatSR(&format[3], maxCpuText->sr);
else PhInitFormatC(&format[3], L' ');
+4
View File
@@ -1392,6 +1392,7 @@ typedef enum _PHP_OPTIONS_INDEX
PHP_OPTIONS_INDEX_ENABLE_DRIVER,
PHP_OPTIONS_INDEX_ENABLE_MONOSPACE,
PHP_OPTIONS_INDEX_ENABLE_PLUGINS,
PHP_OPTIONS_INDEX_ENABLE_AVX_EXTENSIONS,
PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS,
PHP_OPTIONS_INDEX_ENABLE_COLUMN_HEADER_TOTALS,
PHP_OPTIONS_INDEX_ENABLE_CYCLE_CPU_USAGE,
@@ -1438,6 +1439,7 @@ static VOID PhpAdvancedPageLoad(
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MONOSPACE, L"Enable monospace fonts", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"Enable plugins", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"Enable undecorated symbols", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_AVX_EXTENSIONS, L"Enable AVX extensions (experimental)", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_COLUMN_HEADER_TOTALS, L"Enable column header totals (experimental)", NULL);
#ifdef _ARM64_
// see: PhpEstimateIdleCyclesForARM (jxy-s)
@@ -1474,6 +1476,7 @@ static VOID PhpAdvancedPageLoad(
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_WARNINGS, L"EnableWarnings");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"EnablePlugins");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"DbgHelpUndecorate");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_AVX_EXTENSIONS, L"EnableAvxSupport");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_COLUMN_HEADER_TOTALS, L"TreeListEnableHeaderTotals");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
#ifdef _ARM64_
@@ -1660,6 +1663,7 @@ static VOID PhpAdvancedPageSave(
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_WARNINGS, L"EnableWarnings");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"EnablePlugins");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"DbgHelpUndecorate");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_AVX_EXTENSIONS, L"EnableAvxSupport");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_COLUMN_HEADER_TOTALS, L"TreeListEnableHeaderTotals");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
#ifdef _ARM64_
+2 -2
View File
@@ -566,7 +566,7 @@ VOID PhpCreateProcessPropSheetWaitContext(
PhpProcessPropertiesWaitCallback,
waitContext,
INFINITE,
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD | WT_EXECUTELONGFUNCTION
)))
{
PropContext->ProcessWaitContext = waitContext;
@@ -587,7 +587,7 @@ VOID PhpFlushProcessPropSheetWaitContextData(
VOID
)
{
PSLIST_ENTRY entry;
PSLIST_ENTRY entry = NULL;
PPH_PROCESS_WAITPROPCONTEXT data;
PROCESS_BASIC_INFORMATION basicInfo;
+1 -1
View File
@@ -238,7 +238,7 @@ BOOLEAN PhProcessProviderInitialization(
PhProcessItemType = PhCreateObjectType(L"ProcessItem", 0, PhpProcessItemDeleteProcedure);
PhProcessRecordList = PhCreateList(40);
PhProcessRecordList = PhCreateList(512);
PhEnableProcessExtension = WindowsVersion >= WINDOWS_10_RS3 && !PhIsExecutingInWow64();
+178 -2
View File
@@ -20,6 +20,10 @@
#include <srvprv.h>
#include <mainwnd.h>
#include <proctree.h>
#include <mainwndp.h>
#include <hndlinfo.h>
typedef struct _PH_SERVICES_CONTEXT
{
PPH_SERVICE_ITEM *Services;
@@ -425,6 +429,8 @@ INT_PTR CALLBACK PhpServicesPageProc(
{
menu = PhCreateEMenu();
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, 1, L"Go to service", NULL, NULL), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX);
PhServiceListInsertContextMenu(hwndDlg, menu, (PPH_SERVICE_ITEM*)listviewItems, numberOfItems);
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy", NULL, NULL), ULONG_MAX);
PhInsertCopyListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle);
@@ -452,8 +458,178 @@ INT_PTR CALLBACK PhpServicesPageProc(
{
case 1:
{
ProcessHacker_SelectTabPage(1);
ProcessHacker_SelectServiceItem((PPH_SERVICE_ITEM)listviewItems[0]);
SetForegroundWindow(PhMwpServiceTreeNewHandle);
SystemInformer_SelectTabPage(1);
SetFocus(PhMwpServiceTreeNewHandle);
SystemInformer_SelectServiceItem((PPH_SERVICE_ITEM)listviewItems[0]);
}
break;
case ID_SERVICE_GOTOPROCESS:
{
PPH_SERVICE_ITEM serviceItem = (PPH_SERVICE_ITEM)listviewItems[0];
PPH_PROCESS_NODE processNode;
if (serviceItem)
{
if (processNode = PhFindProcessNode(serviceItem->ProcessId))
{
SetForegroundWindow(PhMwpProcessTreeNewHandle);
SystemInformer_SelectTabPage(0);
SetFocus(PhMwpProcessTreeNewHandle);
PhSelectAndEnsureVisibleProcessNode(processNode);
}
else
{
PhShowStatus(hwndDlg, L"The process does not exist.", STATUS_INVALID_CID, 0);
}
}
}
break;
case ID_SERVICE_START:
{
PPH_SERVICE_ITEM* serviceItems = (PPH_SERVICE_ITEM*)listviewItems;
ULONG numberOfServiceItems = numberOfItems;
PhReferenceObjects(serviceItems, numberOfServiceItems);
PhUiStartServices(hwndDlg, serviceItems, numberOfServiceItems);
PhDereferenceObjects(serviceItems, numberOfServiceItems);
}
break;
case ID_SERVICE_CONTINUE:
{
PPH_SERVICE_ITEM* serviceItems = (PPH_SERVICE_ITEM*)listviewItems;
ULONG numberOfServiceItems = numberOfItems;
PhReferenceObjects(serviceItems, numberOfServiceItems);
PhUiContinueServices(hwndDlg, serviceItems, numberOfServiceItems);
PhDereferenceObjects(serviceItems, numberOfServiceItems);
}
break;
case ID_SERVICE_PAUSE:
{
PPH_SERVICE_ITEM* serviceItems = (PPH_SERVICE_ITEM*)listviewItems;
ULONG numberOfServiceItems = numberOfItems;
PhReferenceObjects(serviceItems, numberOfServiceItems);
PhUiPauseServices(hwndDlg, serviceItems, numberOfServiceItems);
PhDereferenceObjects(serviceItems, numberOfServiceItems);
}
break;
case ID_SERVICE_STOP:
{
PPH_SERVICE_ITEM* serviceItems = (PPH_SERVICE_ITEM*)listviewItems;
ULONG numberOfServiceItems = numberOfItems;
PhReferenceObjects(serviceItems, numberOfServiceItems);
PhUiStopServices(hwndDlg, serviceItems, numberOfServiceItems);
PhDereferenceObjects(serviceItems, numberOfServiceItems);
}
break;
case ID_SERVICE_DELETE:
{
PPH_SERVICE_ITEM serviceItem = (PPH_SERVICE_ITEM)listviewItems[0];
if (serviceItem)
{
PhReferenceObject(serviceItem);
if (PhUiDeleteService(hwndDlg, serviceItem))
{
INT lvItemIndex;
lvItemIndex = PhFindListViewItemByFlags(context->ListViewHandle, INT_ERROR, LVNI_SELECTED);
if (lvItemIndex != INT_ERROR)
{
PhRemoveListViewItem(context->ListViewHandle, lvItemIndex);
}
}
PhDereferenceObject(serviceItem);
}
}
break;
case ID_SERVICE_OPENKEY:
{
PPH_SERVICE_ITEM serviceItem = (PPH_SERVICE_ITEM)listviewItems[0];
if (serviceItem)
{
HANDLE keyHandle;
if (NT_SUCCESS(PhOpenServiceKey(
&keyHandle,
KEY_READ,
&serviceItem->Name->sr
)))
{
PPH_STRING hklmServiceKeyName;
if (NT_SUCCESS(PhQueryObjectName(keyHandle, &hklmServiceKeyName)))
{
PhMoveReference(&hklmServiceKeyName, PhFormatNativeKeyName(hklmServiceKeyName));
PhShellOpenKey2(hwndDlg, hklmServiceKeyName);
PhDereferenceObject(hklmServiceKeyName);
}
else
{
PhShowStatus(hwndDlg, L"The service does not exist.", STATUS_OBJECT_NAME_NOT_FOUND, 0);
}
NtClose(keyHandle);
}
else
{
PhShowStatus(hwndDlg, L"The service does not exist.", STATUS_OBJECT_NAME_NOT_FOUND, 0);
}
}
}
break;
case ID_SERVICE_OPENFILELOCATION:
{
PPH_SERVICE_ITEM serviceItem = (PPH_SERVICE_ITEM)listviewItems[0];
SC_HANDLE serviceHandle;
if (serviceItem && NT_SUCCESS(PhOpenService(&serviceHandle, SERVICE_QUERY_CONFIG, PhGetString(serviceItem->Name))))
{
PPH_STRING fileName;
if (fileName = PhGetServiceHandleFileName(serviceHandle, &serviceItem->Name->sr))
{
PhShellExecuteUserString(
hwndDlg,
L"FileBrowseExecutable",
fileName->Buffer,
FALSE,
L"Make sure the Explorer executable file is present."
);
PhDereferenceObject(fileName);
}
PhCloseServiceHandle(serviceHandle);
}
}
break;
case ID_SERVICE_PROPERTIES:
{
PPH_SERVICE_ITEM serviceItem = listviewItems[0];
if (serviceItem)
{
// The object relies on the list view reference, which could
// disappear if we don't reference the object here.
PhReferenceObject(serviceItem);
PhShowServiceProperties(hwndDlg, serviceItem);
PhDereferenceObject(serviceItem);
}
}
break;
case IDC_COPY:
+3 -3
View File
@@ -1076,7 +1076,7 @@ INT_PTR CALLBACK DotNetPerfPageDlgProc(
// .NET 2/3/4 can sometimes show the TimeInJit value above 100% (dmex)
// https://github.com/dotnet/coreclr/blob/ef1e2ab328087c61a6878c1e84f4fc5d710aebce/src/gc/gcee.cpp#L324
PhInitFormatF(&format[0], (context->DotNetPerfJit.timeInJit << 8) * 100 / (DOUBLE)(context->DotNetPerfJit.timeInJitBase << 8), 2);
PhInitFormatF(&format[0], (context->DotNetPerfJit.timeInJit << 8) * 100.f / (FLOAT)(context->DotNetPerfJit.timeInJitBase << 8), 2);
if (PhFormatToBuffer(format, RTL_NUMBER_OF(format), formatBuffer, sizeof(formatBuffer), NULL))
{
@@ -1502,7 +1502,7 @@ INT_PTR CALLBACK DotNetPerfPageDlgProc(
PH_FORMAT format[1];
WCHAR formatBuffer[10];
PhInitFormatF(&format[0], (DOUBLE)context->DotNetPerfGC.timeInGC * 100 / (DOUBLE)context->DotNetPerfGC.timeInGCBase, 2);
PhInitFormatF(&format[0], (FLOAT)context->DotNetPerfGC.timeInGC * 100.f / (FLOAT)context->DotNetPerfGC.timeInGCBase, 2);
if (PhFormatToBuffer(format, RTL_NUMBER_OF(format), formatBuffer, sizeof(formatBuffer), NULL))
{
@@ -1727,7 +1727,7 @@ INT_PTR CALLBACK DotNetPerfPageDlgProc(
PH_FORMAT format[1];
WCHAR formatBuffer[10];
PhInitFormatF(&format[0], (DOUBLE)context->DotNetPerfSecurity.timeRTchecks * 100 / (DOUBLE)context->DotNetPerfSecurity.timeRTchecksBase, 2);
PhInitFormatF(&format[0], (FLOAT)context->DotNetPerfSecurity.timeRTchecks * 100.f / (FLOAT)context->DotNetPerfSecurity.timeRTchecksBase, 2);
if (PhFormatToBuffer(format, RTL_NUMBER_OF(format), formatBuffer, sizeof(formatBuffer), NULL))
{
+1 -1
View File
@@ -259,7 +259,7 @@ typedef struct {
//
// ALIGN_POINTER - aligns a pointer to the lowest boundry
//
#define ALIGN_POINTER(p, s) ((VOID *) (p + ((s - ((UINTN) p)) & (s - 1))))
//#define ALIGN_POINTER(p, s) ((VOID *) (p + ((s - ((UINTN) p)) & (s - 1))))
//
// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
+19 -19
View File
@@ -259,26 +259,26 @@ VOID PresentMonUpdateProcessStats(
auto const& lastPresented = *chain.mPresentHistory[(chain.mNextPresentIndex - 2) % SwapChainData::PRESENT_HISTORY_MAX_COUNT];
USHORT runtime = static_cast<USHORT>(presentN.Runtime);
USHORT presentMode = static_cast<USHORT>(presentN.PresentMode);
DOUBLE cpuAvg;
DOUBLE dspAvg = 0.0;
DOUBLE latAvg = 0.0;
DOUBLE frameLatency = 0;
DOUBLE framesPerSecond = 0;
DOUBLE displayLatency = 0;
DOUBLE displayFramesPerSecond = 0;
DOUBLE msBetweenPresents;
DOUBLE msInPresentApi;
DOUBLE msUntilRenderComplete = 0.0;
DOUBLE msUntilDisplayed = 0.0;
FLOAT cpuAvg;
FLOAT dspAvg = 0.0;
FLOAT latAvg = 0.0;
FLOAT frameLatency = 0;
FLOAT framesPerSecond = 0;
FLOAT displayLatency = 0;
FLOAT displayFramesPerSecond = 0;
FLOAT msBetweenPresents;
FLOAT msInPresentApi;
FLOAT msUntilRenderComplete = 0.0;
FLOAT msUntilDisplayed = 0.0;
cpuAvg = QpcDeltaToSeconds(presentN.PresentStartTime - present0.PresentStartTime) / (chain.mPresentHistoryCount - 1);
msBetweenPresents = 1000.0 * QpcDeltaToSeconds(presentN.PresentStartTime - lastPresented.PresentStartTime);
msInPresentApi = 1000.0 * QpcDeltaToSeconds(presentN.PresentStopTime);
msBetweenPresents = 1000.f * QpcDeltaToSeconds(presentN.PresentStartTime - lastPresented.PresentStartTime);
msInPresentApi = 1000.f * QpcDeltaToSeconds(presentN.PresentStopTime);
if (cpuAvg)
{
frameLatency = 1000.0 * cpuAvg;
framesPerSecond = 1.0 / cpuAvg;
frameLatency = 1000.f * cpuAvg;
framesPerSecond = 1.f / cpuAvg;
}
//if (args.mTrackDisplay)
@@ -317,22 +317,22 @@ VOID PresentMonUpdateProcessStats(
if (latAvg)
{
displayLatency = 1000.0 * latAvg;
displayLatency = 1000.f * latAvg;
}
if (dspAvg)
{
displayFramesPerSecond = 1.0 / dspAvg;
displayFramesPerSecond = 1.f / dspAvg;
}
if (presentN.ReadyTime > 0)
{
msUntilRenderComplete = 1000.0 * QpcDeltaToSeconds(presentN.ReadyTime - presentN.PresentStartTime);
msUntilRenderComplete = 1000.f * QpcDeltaToSeconds(presentN.ReadyTime - presentN.PresentStartTime);
}
if (presentN.FinalState == PresentResult::Presented)
{
msUntilDisplayed = 1000.0 * QpcDeltaToSeconds(presentN.ScreenTime - presentN.PresentStartTime);
msUntilDisplayed = 1000.f * QpcDeltaToSeconds(presentN.ScreenTime - presentN.PresentStartTime);
//if (chain.mLastDisplayedPresentIndex != UINT32_MAX)
//{
@@ -57,6 +57,6 @@ VOID StopOutputThread(VOID);
// TraceSession.cpp:
VOID DequeueAnalyzedInfo(std::vector<std::shared_ptr<PresentEvent>>* presentEvents); // std::vector<std::shared_ptr<PresentEvent>>* lostPresentEvents
DOUBLE QpcDeltaToSeconds(_In_ ULONGLONG qpcDelta);
ULONGLONG SecondsDeltaToQpc(_In_ DOUBLE secondsDelta);
DOUBLE QpcToSeconds(_In_ ULONGLONG qpc);
FLOAT QpcDeltaToSeconds(_In_ ULONGLONG qpcDelta);
ULONGLONG SecondsDeltaToQpc(_In_ FLOAT secondsDelta);
FLOAT QpcToSeconds(_In_ ULONGLONG qpc);
@@ -439,21 +439,21 @@ VOID DequeueAnalyzedInfo(
//DequeueLostPresentEvents(*lostPresentEvents);
}
DOUBLE QpcDeltaToSeconds(
FLOAT QpcDeltaToSeconds(
_In_ ULONGLONG qpcDelta
)
{
return static_cast<DOUBLE>(qpcDelta) / static_cast<DOUBLE>(TraceFrequencyQpc.QuadPart);
return static_cast<FLOAT>(qpcDelta) / static_cast<FLOAT>(TraceFrequencyQpc.QuadPart);
}
ULONGLONG SecondsDeltaToQpc(
_In_ DOUBLE secondsDelta
_In_ FLOAT secondsDelta
)
{
return static_cast<ULONGLONG>(secondsDelta * static_cast<DOUBLE>(TraceFrequencyQpc.QuadPart));
return static_cast<ULONGLONG>(secondsDelta * static_cast<FLOAT>(TraceFrequencyQpc.QuadPart));
}
DOUBLE QpcToSeconds(
FLOAT QpcToSeconds(
_In_ ULONGLONG qpc
)
{
+9 -21
View File
@@ -1088,6 +1088,7 @@ ULONG EtPerfCounterAddCounters(
counterIdentifierLength = ALIGN_UP_BY(sizeof(PERF_COUNTER_IDENTIFIER) + sizeof(PERF_WILDCARD_INSTANCE), 8);
counterIdentifierBuffer = _malloca(counterIdentifierLength);
if (!counterIdentifierBuffer) return ERROR_INSUFFICIENT_BUFFER;
memset(counterIdentifierBuffer, 0, counterIdentifierLength);
counterIdentifierBuffer->Size = counterIdentifierLength;
counterIdentifierBuffer->CounterSetGuid = CounterGuid;
@@ -1123,24 +1124,10 @@ BOOLEAN EtPerfCounterGetCounterData(
{
static ULONG initialBufferSize = 0x4000;
ULONG status;
ULONG returnSize;
ULONG bufferSize;
PPERF_DATA_HEADER buffer;
{
static ULONG64 lastTickCount = 0;
ULONG64 tickCount = NtGetTickCount64();
if (lastTickCount == 0)
lastTickCount = tickCount;
if (tickCount - lastTickCount >= 600 * 1000)
{
lastTickCount = tickCount;
// Reset initial buffer size.
initialBufferSize = 0x4000;
}
}
bufferSize = initialBufferSize;
buffer = PhAllocate(bufferSize);
@@ -1148,14 +1135,12 @@ BOOLEAN EtPerfCounterGetCounterData(
CounterHandle,
buffer,
bufferSize,
&bufferSize
&returnSize
);
if (status == ERROR_NOT_ENOUGH_MEMORY)
{
if (initialBufferSize < bufferSize)
initialBufferSize = bufferSize;
bufferSize = returnSize;
PhFree(buffer);
buffer = PhAllocate(bufferSize);
@@ -1163,12 +1148,15 @@ BOOLEAN EtPerfCounterGetCounterData(
CounterHandle,
buffer,
bufferSize,
&bufferSize
&returnSize
);
}
if (status == ERROR_SUCCESS)
{
if (initialBufferSize > bufferSize)
initialBufferSize = bufferSize;
*CounterBuffer = buffer;
return TRUE;
}
@@ -1293,7 +1281,7 @@ BOOLEAN EtPerfCounterGetCounterData(
// return status;
//}
_Success_(return)
_Success_(return == 0)
ULONG EtPerfCounterOpenHandle(
_Out_ PHANDLE PerfQueryHandle
)
+2 -2
View File
@@ -91,8 +91,8 @@ BOOLEAN EtpDiskPageCallback(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | thinRows | treelistBorder | treelistCustomColors,
0,
0,
3,
3,
0,
0,
Parameter2,
NULL,
NULL,
+8 -8
View File
@@ -89,8 +89,8 @@ VOID EtwDiskCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -104,8 +104,8 @@ VOID EtwDiskCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -124,8 +124,8 @@ VOID EtwNetworkCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -139,8 +139,8 @@ VOID EtwNetworkCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
+8 -8
View File
@@ -392,8 +392,8 @@ VOID EtpCreateDiskGraph(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
DiskDialog,
NULL,
PluginInstance->DllBase,
@@ -407,8 +407,8 @@ VOID EtpCreateDiskGraph(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
DiskDialog,
NULL,
PluginInstance->DllBase,
@@ -1156,8 +1156,8 @@ VOID EtpCreateNetworkGraph(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NetworkDialog,
NULL,
NULL,
@@ -1171,8 +1171,8 @@ VOID EtpCreateNetworkGraph(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NetworkDialog,
NULL,
NULL,
+1 -8
View File
@@ -550,7 +550,7 @@ VOID EtFormatNetworkSize(
);
VOID EtFormatDouble(
_In_ DOUBLE Value,
_In_ FLOAT Value,
_In_ PET_PROCESS_BLOCK Block,
_In_ PPH_PLUGIN_TREENEW_MESSAGE Message
);
@@ -1018,13 +1018,6 @@ VOID EtEtwMiniInformationInitializing(
// iconext
typedef struct _TB_GRAPH_CONTEXT
{
LONG GraphDpi;
ULONG GraphColor1;
ULONG GraphColor2;
} TB_GRAPH_CONTEXT, *PTB_GRAPH_CONTEXT;
extern BOOLEAN EtTrayIconTransparencyEnabled;
VOID EtLoadTrayIconGuids(
+2 -2
View File
@@ -55,9 +55,9 @@ PPH_STRING FramesLabelYFunction(
_In_ FLOAT Parameter
)
{
DOUBLE value;
FLOAT value;
value = (DOUBLE)((DOUBLE)Value * Parameter);
value = (FLOAT)(Value * Parameter);
if (value != 0)
{
+11 -2
View File
@@ -70,8 +70,8 @@ BOOLEAN FwTabPageCallback(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | thinRows | treelistBorder | treelistCustomColors,
0,
0,
3,
3,
0,
0,
Parameter2,
NULL,
PluginInstance->DllBase,
@@ -324,6 +324,15 @@ VOID LoadSettingsFwTreeList(
sortSettings = PhGetIntegerPairSetting(SETTING_NAME_FW_TREE_LIST_SORT);
TreeNew_SetSort(TreeNewHandle, (ULONG)sortSettings.X, (PH_SORT_ORDER)sortSettings.Y);
if (PhGetIntegerSetting(L"EnableInstantTooltips"))
{
SendMessage(TreeNew_GetTooltips(TreeNewHandle), TTM_SETDELAYTIME, TTDT_INITIAL, 0);
}
else
{
SendMessage(TreeNew_GetTooltips(TreeNewHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT);
}
}
VOID SaveSettingsFwTreeList(
+4 -4
View File
@@ -594,7 +594,7 @@ VOID NTAPI EtGpuProcessesUpdatedCallback(
)
{
static ULONG runCount = 0; // MUST keep in sync with runCount in process provider
DOUBLE elapsedTime = 0; // total GPU node elapsed time in micro-seconds
FLOAT elapsedTime = 0; // total GPU node elapsed time in micro-seconds
FLOAT tempGpuUsage = 0;
ULONG i;
PLIST_ENTRY listEntry;
@@ -626,13 +626,13 @@ VOID NTAPI EtGpuProcessesUpdatedCallback(
EtpGpuUpdateSystemSegmentInformation();
EtpGpuUpdateSystemNodeInformation();
elapsedTime = (DOUBLE)EtGpuClockTotalRunningTimeDelta.Delta * 10000000 / EtGpuClockTotalRunningTimeFrequency.QuadPart;
elapsedTime = (FLOAT)EtGpuClockTotalRunningTimeDelta.Delta * 10000000 / (FLOAT)EtGpuClockTotalRunningTimeFrequency.QuadPart;
if (elapsedTime != 0)
{
for (i = 0; i < EtGpuTotalNodeCount; i++)
{
FLOAT usage = (FLOAT)(EtGpuNodesTotalRunningTimeDelta[i].Delta / elapsedTime);
FLOAT usage = (FLOAT)(EtGpuNodesTotalRunningTimeDelta[i].Delta / (FLOAT)elapsedTime);
if (usage > 1)
usage = 1;
@@ -730,7 +730,7 @@ VOID NTAPI EtGpuProcessesUpdatedCallback(
block = CONTAINING_RECORD(listEntry, ET_PROCESS_BLOCK, ListEntry);
if (block->ProcessItem->State & PH_PROCESS_ITEM_REMOVED)
if (FlagOn(block->ProcessItem->State, PH_PROCESS_ITEM_REMOVED))
{
listEntry = listEntry->Flink;
continue;
+9 -9
View File
@@ -60,8 +60,8 @@ VOID GpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -75,8 +75,8 @@ VOID GpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -90,8 +90,8 @@ VOID GpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -105,8 +105,8 @@ VOID GpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -516,7 +516,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
PH_FORMAT format[2];
// %.2f%%
PhInitFormatF(&format[0], context->Block->GpuCurrentUsage * 100, 2);
PhInitFormatFD(&format[0], context->Block->GpuCurrentUsage * 100, 2);
PhInitFormatC(&format[1], L'%');
PhMoveReference(&context->GpuGraphState.Text, PhFormat(format, RTL_NUMBER_OF(format), 0));
+8 -8
View File
@@ -232,7 +232,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[5];
// %.2f%%\n%s / %s
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuDedicatedUsage);
PhInitFormatS(&format[3], L" / ");
@@ -241,7 +241,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
drawPanel->SubTitle = PhFormat(format, 5, 64);
// %.2f%%\n%s
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuDedicatedUsage);
@@ -252,7 +252,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[5];
// %.2f%%\n%s / %s
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuSharedUsage);
PhInitFormatS(&format[3], L" / ");
@@ -261,7 +261,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
drawPanel->SubTitle = PhFormat(format, 5, 64);
// %.2f%%\n%s
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuSharedUsage);
@@ -272,7 +272,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[2];
// %.2f%%\n
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
drawPanel->SubTitle = PhFormat(format, RTL_NUMBER_OF(format), 0);
@@ -807,12 +807,12 @@ PPH_STRING EtpGpuTemperatureGraphLabelYFunction(
if (EtGpuFahrenheitEnabled)
{
PhInitFormatF(&format[0], (ULONG)(Value * Parameter) * 1.8 + 32, 1);
PhInitFormatF(&format[0], (ULONG)(Value * Parameter) * 1.8f + 32.f, 1);
PhInitFormatS(&format[1], L"\u00b0F");
}
else
{
PhInitFormatF(&format[0], (ULONG)(Value * Parameter), 1);
PhInitFormatU(&format[0], (ULONG)(Value * Parameter));
PhInitFormatS(&format[1], L"\u00b0C\n");
}
@@ -1236,7 +1236,7 @@ VOID EtpNotifyTemperatureGpuGraph(
if (EtGpuFahrenheitEnabled)
{
PhInitFormatF(&format[0], (temp * 1.8 + 32), 1);
PhInitFormatF(&format[0], (temp * 1.8f + 32.f), 1);
PhInitFormatS(&format[1], L"\u00b0F\n");
PhInitFormatSR(&format[2], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
}
+164 -165
View File
@@ -134,7 +134,7 @@ VOID EtpNetworkTextIconUpdateCallback(
);
VOID EtpGpuMemoryIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -142,7 +142,7 @@ VOID EtpGpuMemoryIconUpdateCallback(
);
VOID EtpGpuMemoryTextIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -150,7 +150,7 @@ VOID EtpGpuMemoryTextIconUpdateCallback(
);
VOID EtpGpuTemperatureIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -158,7 +158,7 @@ VOID EtpGpuTemperatureIconUpdateCallback(
);
VOID EtpGpuTemperatureTextIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -167,11 +167,6 @@ VOID EtpGpuTemperatureTextIconUpdateCallback(
BOOLEAN EtTrayIconTransparencyEnabled = FALSE;
GUID EtpTrayIconGuids[ETP_TRAY_ICON_GUID_MAXIMUM];
PH_CALLBACK_REGISTRATION EtpMainWindowMessageEventRegistration;
TB_GRAPH_CONTEXT EtpToolbarGpuHistoryGraphContext = { 0 };
TB_GRAPH_CONTEXT EtpToolbarNpuHistoryGraphContext = { 0 };
TB_GRAPH_CONTEXT EtpToolbarDiskHistoryGraphContext = { 0 };
TB_GRAPH_CONTEXT EtpToolbarNetworkHistoryGraphContext = { 0 };
VOID EtLoadTrayIconGuids(
VOID
@@ -466,7 +461,7 @@ VOID EtpGpuIconUpdateCallback(
maxGpuProcessItem = NULL;
PhInitFormatS(&format[0], L"GPU usage: ");
PhInitFormatF(&format[1], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[1], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatC(&format[2], '%');
if (maxGpuProcessItem)
@@ -474,11 +469,11 @@ VOID EtpGpuIconUpdateCallback(
PhInitFormatC(&format[3], '\n');
PhInitFormatSR(&format[4], maxGpuProcessItem->ProcessName->sr);
PhInitFormatS(&format[5], L": ");
PhInitFormatF(&format[6], EtGetProcessBlock(maxGpuProcessItem)->GpuNodeUtilization * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[6], EtGetProcessBlock(maxGpuProcessItem)->GpuNodeUtilization * 100, EtMaxPrecisionUnit);
PhInitFormatC(&format[7], '%');
}
*NewText = PhFormat(format, maxGpuProcessItem ? 8 : 3, 128);
*NewText = PhFormat(format, maxGpuProcessItem ? 8 : 3, 0);
if (maxGpuProcessItem) PhDereferenceObject(maxGpuProcessItem);
_freea(lineData1);
@@ -598,7 +593,7 @@ VOID EtpNpuIconUpdateCallback(
PhInitFormatC(&format[7], '%');
}
*NewText = PhFormat(format, maxNpuProcessItem ? 8 : 3, 128);
*NewText = PhFormat(format, maxNpuProcessItem ? 8 : 3, 0);
if (maxNpuProcessItem) PhDereferenceObject(maxNpuProcessItem);
_freea(lineData1);
@@ -735,7 +730,7 @@ VOID EtpDiskIconUpdateCallback(
PhInitFormatSR(&format[5], maxDiskProcessItem->ProcessName->sr);
}
*NewText = PhFormat(format, maxDiskProcessItem ? 6 : 4, 128);
*NewText = PhFormat(format, maxDiskProcessItem ? 6 : 4, 0);
if (maxDiskProcessItem) PhDereferenceObject(maxDiskProcessItem);
_freea(lineData2);
@@ -890,7 +885,7 @@ VOID EtpNetworkIconUpdateCallback(
PhInitFormatSR(&format[5], maxNetworkProcessItem->ProcessName->sr);
}
*NewText = PhFormat(format, maxNetworkProcessItem ? 6 : 4, 128);
*NewText = PhFormat(format, maxNetworkProcessItem ? 6 : 4, 0);
if (maxNetworkProcessItem) PhDereferenceObject(maxNetworkProcessItem);
_freea(lineData2);
@@ -956,8 +951,8 @@ VOID EtpGpuTextIconUpdateCallback(
Icon->Pointers->BeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 0);
text = PhFormat(format, 1, 10);
PhInitFormatFD(&format[0], EtGpuNodeUsage * 100, 0);
text = PhFormat(format, 1, 0);
drawInfo.TextFont = PhNfGetTrayIconFont(0);
drawInfo.TextColor = PhGetIntegerSetting(L"ColorCpuKernel");
@@ -986,7 +981,7 @@ VOID EtpGpuTextIconUpdateCallback(
maxGpuProcessItem = NULL;
PhInitFormatS(&format[0], L"GPU usage: ");
PhInitFormatF(&format[1], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[1], EtGpuNodeUsage * 100, EtMaxPrecisionUnit);
PhInitFormatC(&format[2], '%');
if (maxGpuProcessItem)
@@ -994,11 +989,11 @@ VOID EtpGpuTextIconUpdateCallback(
PhInitFormatC(&format[3], '\n');
PhInitFormatSR(&format[4], maxGpuProcessItem->ProcessName->sr);
PhInitFormatS(&format[5], L": ");
PhInitFormatF(&format[6], EtGetProcessBlock(maxGpuProcessItem)->GpuNodeUtilization * 100, EtMaxPrecisionUnit);
PhInitFormatFD(&format[6], EtGetProcessBlock(maxGpuProcessItem)->GpuNodeUtilization * 100, EtMaxPrecisionUnit);
PhInitFormatC(&format[7], '%');
}
*NewText = PhFormat(format, maxGpuProcessItem ? 8 : 3, 128);
*NewText = PhFormat(format, maxGpuProcessItem ? 8 : 3, 0);
if (maxGpuProcessItem) PhDereferenceObject(maxGpuProcessItem);
}
@@ -1042,8 +1037,8 @@ VOID EtpDiskTextIconUpdateCallback(
if (maxValue < ((ULONG64)EtDiskReadDelta.Delta + EtDiskWriteDelta.Delta))
maxValue = ((ULONG64)EtDiskReadDelta.Delta + EtDiskWriteDelta.Delta);
PhInitFormatF(&format[0], ((DOUBLE)EtDiskReadDelta.Delta + EtDiskWriteDelta.Delta) / maxValue * 100, 0);
text = PhFormat(format, 1, 10);
PhInitFormatF(&format[0], ((FLOAT)EtDiskReadDelta.Delta + EtDiskWriteDelta.Delta) / maxValue * 100, 0);
text = PhFormat(format, 1, 0);
drawInfo.TextFont = PhNfGetTrayIconFont(0);
drawInfo.TextColor = PhGetIntegerSetting(L"ColorIoReadOther"); // ColorIoWrite
@@ -1082,7 +1077,7 @@ VOID EtpDiskTextIconUpdateCallback(
PhInitFormatSR(&format[5], maxDiskProcessItem->ProcessName->sr);
}
*NewText = PhFormat(format, maxDiskProcessItem ? 6 : 4, 128);
*NewText = PhFormat(format, maxDiskProcessItem ? 6 : 4, 0);
if (maxDiskProcessItem) PhDereferenceObject(maxDiskProcessItem);
}
@@ -1126,8 +1121,8 @@ VOID EtpNetworkTextIconUpdateCallback(
if (maxValue < ((ULONG64)EtNetworkReceiveDelta.Delta + EtNetworkSendDelta.Delta))
maxValue = ((ULONG64)EtNetworkReceiveDelta.Delta + EtNetworkSendDelta.Delta);
PhInitFormatF(&format[0], ((DOUBLE)EtNetworkReceiveDelta.Delta + EtNetworkSendDelta.Delta) / maxValue * 100, 0);
text = PhFormat(format, 1, 10);
PhInitFormatF(&format[0], ((FLOAT)EtNetworkReceiveDelta.Delta + EtNetworkSendDelta.Delta) / maxValue * 100, 0);
text = PhFormat(format, 1, 0);
drawInfo.TextFont = PhNfGetTrayIconFont(0);
drawInfo.TextColor = PhGetIntegerSetting(L"ColorIoReadOther"); // ColorIoWrite
@@ -1166,7 +1161,7 @@ VOID EtpNetworkTextIconUpdateCallback(
PhInitFormatSR(&format[5], maxNetworkProcessItem->ProcessName->sr);
}
*NewText = PhFormat(format, maxNetworkProcessItem ? 6 : 4, 128);
*NewText = PhFormat(format, maxNetworkProcessItem ? 6 : 4, 0);
if (maxNetworkProcessItem) PhDereferenceObject(maxNetworkProcessItem);
}
@@ -1247,7 +1242,7 @@ VOID EtpGpuMemoryIconUpdateCallback(
PhInitFormatS(&format[0], L"GPU memory usage: ");
PhInitFormatSize(&format[1], EtGpuDedicatedUsage);
*NewText = PhFormat(format, 2, 128);
*NewText = PhFormat(format, 2, 0);
_freea(lineData1);
}
@@ -1286,8 +1281,8 @@ VOID EtpGpuMemoryTextIconUpdateCallback(
Icon->Pointers->BeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
PhInitFormatF(&format[0], (EtGpuDedicatedUsage * 100.0f) / EtGpuDedicatedLimit, 0);
text = PhFormat(format, 1, 10);
PhInitFormatF(&format[0], (EtGpuDedicatedUsage * 100.f) / EtGpuDedicatedLimit, 0);
text = PhFormat(format, 1, 0);
drawInfo.TextFont = PhNfGetTrayIconFont(0);
drawInfo.TextColor = PhGetIntegerSetting(L"ColorPrivate");
@@ -1308,13 +1303,13 @@ VOID EtpGpuMemoryTextIconUpdateCallback(
PhInitFormatS(&format[0], L"GPU memory usage: ");
PhInitFormatSize(&format[1], EtGpuDedicatedUsage);
*NewText = PhFormat(format, 2, 128);
*NewText = PhFormat(format, 2, 0);
}
// GPU Temperature
VOID EtpGpuTemperatureIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -1385,7 +1380,7 @@ VOID EtpGpuTemperatureIconUpdateCallback(
PhInitFormatS(&format[0], L"GPU temperature: ");
if (EtGpuFahrenheitEnabled)
{
PhInitFormatF(&format[1], (EtGpuTemperature * 1.8 + 32), 1);
PhInitFormatF(&format[1], (EtGpuTemperature * 1.8f + 32), 1);
PhInitFormatS(&format[2], L"\u00b0F");
}
else
@@ -1394,13 +1389,13 @@ VOID EtpGpuTemperatureIconUpdateCallback(
PhInitFormatS(&format[2], L"\u00b0C");
}
*NewText = PhFormat(format, 3, 128);
*NewText = PhFormat(format, 3, 0);
_freea(lineData1);
}
VOID EtpGpuTemperatureTextIconUpdateCallback(
_In_ struct _PH_NF_ICON* Icon,
_In_ PPH_NF_ICON Icon,
_Out_ PVOID* NewIconOrBitmap,
_Out_ PULONG Flags,
_Out_ PPH_STRING* NewText,
@@ -1434,10 +1429,10 @@ VOID EtpGpuTemperatureTextIconUpdateCallback(
Icon->Pointers->BeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
if (EtGpuFahrenheitEnabled)
PhInitFormatF(&format[0], (EtGpuTemperature * 1.8 + 32), 0);
PhInitFormatF(&format[0], (EtGpuTemperature * 1.8f + 32), 0);
else
PhInitFormatF(&format[0], EtGpuTemperature, 0);
text = PhFormat(format, 1, 10);
text = PhFormat(format, 1, 0);
drawInfo.TextFont = PhNfGetTrayIconFont(0);
drawInfo.TextColor = PhGetIntegerSetting(L"ColorTemperature");
@@ -1458,7 +1453,7 @@ VOID EtpGpuTemperatureTextIconUpdateCallback(
PhInitFormatS(&format[0], L"GPU temperature: ");
if (EtGpuFahrenheitEnabled)
{
PhInitFormatF(&format[1], (EtGpuTemperature * 1.8 + 32), 1);
PhInitFormatF(&format[1], (EtGpuTemperature * 1.8f + 32), 1);
PhInitFormatS(&format[2], L"\u00b0F");
}
else
@@ -1467,50 +1462,57 @@ VOID EtpGpuTemperatureTextIconUpdateCallback(
PhInitFormatS(&format[2], L"\u00b0C");
}
*NewText = PhFormat(format, 3, 128);
*NewText = PhFormat(format, 3, 0);
}
// Toolbar graphs
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarGpuHistoryGraphMessageCallback)
BOOLEAN EtpToolbarGpuHistoryGraphMessageCallback(
_In_ HWND WindowHandle,
_In_ ULONG Message,
_In_ PVOID Parameter1,
_In_ PVOID Parameter2,
_In_ PVOID Context
)
{
switch (Header->code)
switch (Message)
{
case GCN_GETDRAWINFO:
{
PTB_GRAPH_CONTEXT context = (PTB_GRAPH_CONTEXT)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Parameter1;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
if (context->GraphDpi == 0)
if (graph->GraphDpi == 0)
{
context->GraphDpi = PhGetWindowDpi(GraphHandle);
context->GraphColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
graph->GraphDpi = PhGetWindowDpi(WindowHandle);
graph->GraphColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
}
drawInfo->Flags = PH_GRAPH_USE_GRID_X;
PhSiSetColorsGraphDrawInfo(drawInfo, context->GraphColor1, 0, context->GraphDpi);
PhSiSetColorsGraphDrawInfo(drawInfo, graph->GraphColor1, 0, graph->GraphDpi);
if (ProcessesUpdatedCount != 3)
break;
PhGraphStateGetDrawInfo(GraphState, getDrawInfo, EtGpuNodeHistory.Count);
PhGraphStateGetDrawInfo(&graph->GraphState, getDrawInfo, EtGpuNodeHistory.Count);
if (!GraphState->Valid)
if (!graph->GraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&EtGpuNodeHistory, GraphState->Data1, drawInfo->LineDataCount);
PhCopyCircularBuffer_FLOAT(&EtGpuNodeHistory, graph->GraphState.Data1, drawInfo->LineDataCount);
GraphState->Valid = TRUE;
graph->GraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Parameter1;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (GraphState->TooltipIndex != getTooltipText->Index)
if (graph->GraphState.TooltipIndex != getTooltipText->Index)
{
FLOAT gpuUsage;
PH_FORMAT format[5];
@@ -1524,16 +1526,17 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarGpuHistoryGraphMessageCallba
PhInitFormatC(&format[3], L'\n');
PhInitFormatSR(&format[4], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
PhMoveReference(&GraphState->TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 160));
PhMoveReference(&graph->GraphState.TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 0));
}
getTooltipText->Text = PhGetStringRef(GraphState->TooltipText);
getTooltipText->Text = PhGetStringRef(graph->GraphState.TooltipText);
}
}
break;
case GCN_MOUSEEVENT:
{
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Parameter1;
PPH_PROCESS_RECORD record = NULL;
if (mouseEvent->Message == WM_LBUTTONDBLCLK)
@@ -1551,7 +1554,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarGpuHistoryGraphMessageCallba
if (record)
{
PhShowProcessRecordDialog(PhMainWndHandle, record);
PhShowProcessRecordDialog(SystemInformer_GetWindowHandle(), record);
PhDereferenceProcessRecord(record);
}
}
@@ -1559,47 +1562,56 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarGpuHistoryGraphMessageCallba
}
break;
}
return TRUE;
}
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNpuHistoryGraphMessageCallback)
BOOLEAN EtpToolbarNpuHistoryGraphMessageCallback(
_In_ HWND WindowHandle,
_In_ ULONG Message,
_In_ PVOID Parameter1,
_In_ PVOID Parameter2,
_In_ PVOID Context
)
{
switch (Header->code)
switch (Message)
{
case GCN_GETDRAWINFO:
{
PTB_GRAPH_CONTEXT context = (PTB_GRAPH_CONTEXT)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Parameter1;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
if (context->GraphDpi == 0)
if (graph->GraphDpi == 0)
{
context->GraphDpi = PhGetWindowDpi(GraphHandle);
context->GraphColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
graph->GraphDpi = PhGetWindowDpi(WindowHandle);
graph->GraphColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
}
drawInfo->Flags = PH_GRAPH_USE_GRID_X;
PhSiSetColorsGraphDrawInfo(drawInfo, context->GraphColor1, 0, context->GraphDpi);
PhSiSetColorsGraphDrawInfo(drawInfo, graph->GraphColor1, 0, graph->GraphDpi);
if (ProcessesUpdatedCount != 3)
break;
PhGraphStateGetDrawInfo(GraphState, getDrawInfo, EtNpuNodeHistory.Count);
PhGraphStateGetDrawInfo(&graph->GraphState, getDrawInfo, EtNpuNodeHistory.Count);
if (!GraphState->Valid)
if (!graph->GraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&EtNpuNodeHistory, GraphState->Data1, drawInfo->LineDataCount);
PhCopyCircularBuffer_FLOAT(&EtNpuNodeHistory, graph->GraphState.Data1, drawInfo->LineDataCount);
GraphState->Valid = TRUE;
graph->GraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Parameter1;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (GraphState->TooltipIndex != getTooltipText->Index)
if (graph->GraphState.TooltipIndex != getTooltipText->Index)
{
FLOAT gpuUsage;
PH_FORMAT format[5];
@@ -1613,16 +1625,17 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNpuHistoryGraphMessageCallba
PhInitFormatC(&format[3], L'\n');
PhInitFormatSR(&format[4], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
PhMoveReference(&GraphState->TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 160));
PhMoveReference(&graph->GraphState.TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 0));
}
getTooltipText->Text = PhGetStringRef(GraphState->TooltipText);
getTooltipText->Text = PhGetStringRef(graph->GraphState.TooltipText);
}
}
break;
case GCN_MOUSEEVENT:
{
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Parameter1;
PPH_PROCESS_RECORD record = NULL;
if (mouseEvent->Message == WM_LBUTTONDBLCLK)
@@ -1640,7 +1653,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNpuHistoryGraphMessageCallba
if (record)
{
PhShowProcessRecordDialog(PhMainWndHandle, record);
PhShowProcessRecordDialog(SystemInformer_GetWindowHandle(), record);
PhDereferenceProcessRecord(record);
}
}
@@ -1648,38 +1661,46 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNpuHistoryGraphMessageCallba
}
break;
}
return TRUE;
}
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallback)
BOOLEAN EtpToolbarDiskHistoryGraphMessageCallback(
_In_ HWND WindowHandle,
_In_ ULONG Message,
_In_ PVOID Parameter1,
_In_ PVOID Parameter2,
_In_ PVOID Context
)
{
switch (Header->code)
switch (Message)
{
case GCN_GETDRAWINFO:
{
PTB_GRAPH_CONTEXT context = (PTB_GRAPH_CONTEXT)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Parameter1;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
if (context->GraphDpi == 0)
if (graph->GraphDpi == 0)
{
context->GraphDpi = PhGetWindowDpi(GraphHandle);
context->GraphColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
context->GraphColor2 = PhGetIntegerSetting(L"ColorIoWrite");
graph->GraphDpi = PhGetWindowDpi(WindowHandle);
graph->GraphColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
graph->GraphColor2 = PhGetIntegerSetting(L"ColorIoWrite");
}
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_LINE_2;
PhSiSetColorsGraphDrawInfo(drawInfo, context->GraphColor1, context->GraphColor2, context->GraphDpi);
PhSiSetColorsGraphDrawInfo(drawInfo, graph->GraphColor1, graph->GraphColor2, graph->GraphDpi);
if (ProcessesUpdatedCount != 3)
break;
PhGraphStateGetDrawInfo(
GraphState,
&graph->GraphState,
getDrawInfo,
EtDiskReadHistory.Count
);
if (!GraphState->Valid)
if (!graph->GraphState.Valid)
{
ULONG i;
FLOAT max = 1024 * 1024; // Minimum scaling of 1 MB
@@ -1689,11 +1710,11 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
FLOAT data1;
FLOAT data2;
PhCopyConvertCircularBufferULONG(&EtDiskReadHistory, GraphState->Data1, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtDiskWriteHistory, GraphState->Data2, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtDiskReadHistory, graph->GraphState.Data1, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtDiskWriteHistory, graph->GraphState.Data2, drawInfo->LineDataCount);
data1 = PhMaxMemorySingles(GraphState->Data1, drawInfo->LineDataCount);
data2 = PhMaxMemorySingles(GraphState->Data1, drawInfo->LineDataCount);
data1 = PhMaxMemorySingles(graph->GraphState.Data1, drawInfo->LineDataCount);
data2 = PhMaxMemorySingles(graph->GraphState.Data1, drawInfo->LineDataCount);
if (max < data1 + data2)
max = data1 + data2;
@@ -1705,8 +1726,8 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
FLOAT data1;
FLOAT data2;
GraphState->Data1[i] = data1 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtDiskReadHistory, i);
GraphState->Data2[i] = data2 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtDiskWriteHistory, i);
graph->GraphState.Data1[i] = data1 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtDiskReadHistory, i);
graph->GraphState.Data2[i] = data2 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtDiskWriteHistory, i);
if (max < data1 + data2)
max = data1 + data2;
@@ -1718,28 +1739,29 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
// Scale the data.
PhDivideSinglesBySingle(
GraphState->Data1,
graph->GraphState.Data1,
max,
drawInfo->LineDataCount
);
PhDivideSinglesBySingle(
GraphState->Data2,
graph->GraphState.Data2,
max,
drawInfo->LineDataCount
);
}
GraphState->Valid = TRUE;
graph->GraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Parameter1;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (GraphState->TooltipIndex != getTooltipText->Index)
if (graph->GraphState.TooltipIndex != getTooltipText->Index)
{
ULONG64 diskRead;
ULONG64 diskWrite;
@@ -1757,16 +1779,17 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
PhInitFormatC(&format[5], L'\n');
PhInitFormatSR(&format[6], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
PhMoveReference(&GraphState->TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 160));
PhMoveReference(&graph->GraphState.TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 0));
}
getTooltipText->Text = PhGetStringRef(GraphState->TooltipText);
getTooltipText->Text = PhGetStringRef(graph->GraphState.TooltipText);
}
}
break;
case GCN_MOUSEEVENT:
{
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Parameter1;
PPH_PROCESS_RECORD record = NULL;
if (mouseEvent->Message == WM_LBUTTONDBLCLK)
@@ -1784,7 +1807,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
if (record)
{
PhShowProcessRecordDialog(PhMainWndHandle, record);
PhShowProcessRecordDialog(SystemInformer_GetWindowHandle(), record);
PhDereferenceProcessRecord(record);
}
}
@@ -1792,38 +1815,46 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarDiskHistoryGraphMessageCallb
}
break;
}
return TRUE;
}
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCallback)
BOOLEAN EtpToolbarNetworkHistoryGraphMessageCallback(
_In_ HWND WindowHandle,
_In_ ULONG Message,
_In_ PVOID Parameter1,
_In_ PVOID Parameter2,
_In_ PVOID Context
)
{
switch (Header->code)
switch (Message)
{
case GCN_GETDRAWINFO:
{
PTB_GRAPH_CONTEXT context = (PTB_GRAPH_CONTEXT)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Parameter1;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
if (context->GraphDpi == 0)
if (graph->GraphDpi == 0)
{
context->GraphDpi = PhGetWindowDpi(GraphHandle);
context->GraphColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
context->GraphColor2 = PhGetIntegerSetting(L"ColorIoWrite");
graph->GraphDpi = PhGetWindowDpi(WindowHandle);
graph->GraphColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
graph->GraphColor2 = PhGetIntegerSetting(L"ColorIoWrite");
}
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_LINE_2;
PhSiSetColorsGraphDrawInfo(drawInfo, context->GraphColor1, context->GraphColor2, context->GraphDpi);
PhSiSetColorsGraphDrawInfo(drawInfo, graph->GraphColor1, graph->GraphColor2, graph->GraphDpi);
if (ProcessesUpdatedCount != 3)
break;
PhGraphStateGetDrawInfo(
GraphState,
&graph->GraphState,
getDrawInfo,
EtNetworkReceiveHistory.Count
);
if (!GraphState->Valid)
if (!graph->GraphState.Valid)
{
ULONG i;
FLOAT max = 1024 * 1024; // Minimum scaling of 1 MB
@@ -1833,11 +1864,11 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
FLOAT data1;
FLOAT data2;
PhCopyConvertCircularBufferULONG(&EtNetworkReceiveHistory, GraphState->Data1, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtNetworkSendHistory, GraphState->Data2, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtNetworkReceiveHistory, graph->GraphState.Data1, drawInfo->LineDataCount);
PhCopyConvertCircularBufferULONG(&EtNetworkSendHistory, graph->GraphState.Data2, drawInfo->LineDataCount);
data1 = PhMaxMemorySingles(GraphState->Data1, drawInfo->LineDataCount);
data2 = PhMaxMemorySingles(GraphState->Data1, drawInfo->LineDataCount);
data1 = PhMaxMemorySingles(graph->GraphState.Data1, drawInfo->LineDataCount);
data2 = PhMaxMemorySingles(graph->GraphState.Data1, drawInfo->LineDataCount);
if (max < data1 + data2)
max = data1 + data2;
@@ -1849,8 +1880,8 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
FLOAT data1;
FLOAT data2;
GraphState->Data1[i] = data1 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtNetworkReceiveHistory, i);
GraphState->Data2[i] = data2 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtNetworkSendHistory, i);
graph->GraphState.Data1[i] = data1 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtNetworkReceiveHistory, i);
graph->GraphState.Data2[i] = data2 = (FLOAT)PhGetItemCircularBuffer_ULONG(&EtNetworkSendHistory, i);
if (max < data1 + data2)
max = data1 + data2;
@@ -1862,28 +1893,29 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
// Scale the data.
PhDivideSinglesBySingle(
GraphState->Data1,
graph->GraphState.Data1,
max,
drawInfo->LineDataCount
);
PhDivideSinglesBySingle(
GraphState->Data2,
graph->GraphState.Data2,
max,
drawInfo->LineDataCount
);
}
GraphState->Valid = TRUE;
graph->GraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Parameter1;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (GraphState->TooltipIndex != getTooltipText->Index)
if (graph->GraphState.TooltipIndex != getTooltipText->Index)
{
ULONG64 networkReceive;
ULONG64 networkSend;
@@ -1901,16 +1933,17 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
PhInitFormatC(&format[5], L'\n');
PhInitFormatSR(&format[6], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
PhMoveReference(&GraphState->TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 160));
PhMoveReference(&graph->GraphState.TooltipText, PhFormat(format, RTL_NUMBER_OF(format), 0));
}
getTooltipText->Text = PhGetStringRef(GraphState->TooltipText);
getTooltipText->Text = PhGetStringRef(graph->GraphState.TooltipText);
}
}
break;
case GCN_MOUSEEVENT:
{
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Header;
PPH_TOOLBAR_GRAPH graph = (PPH_TOOLBAR_GRAPH)Context;
PPH_GRAPH_MOUSEEVENT mouseEvent = (PPH_GRAPH_MOUSEEVENT)Parameter1;
PPH_PROCESS_RECORD record = NULL;
if (mouseEvent->Message == WM_LBUTTONDBLCLK)
@@ -1928,7 +1961,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
if (record)
{
PhShowProcessRecordDialog(PhMainWndHandle, record);
PhShowProcessRecordDialog(SystemInformer_GetWindowHandle(), record);
PhDereferenceProcessRecord(record);
}
}
@@ -1936,33 +1969,8 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(EtpToolbarNetworkHistoryGraphMessageCa
}
break;
}
}
VOID EtToolbarGraphsInitializeDpi(
VOID
)
{
memset(&EtpToolbarGpuHistoryGraphContext, 0, sizeof(TB_GRAPH_CONTEXT));
memset(&EtpToolbarNpuHistoryGraphContext, 0, sizeof(TB_GRAPH_CONTEXT));
memset(&EtpToolbarDiskHistoryGraphContext, 0, sizeof(TB_GRAPH_CONTEXT));
memset(&EtpToolbarNetworkHistoryGraphContext, 0, sizeof(TB_GRAPH_CONTEXT));
}
VOID NTAPI EtMainWindowMessageEventCallback(
_In_ PVOID Parameter,
_In_ PVOID Context
)
{
PMSG message = Parameter;
switch (message->message)
{
case WM_DPICHANGED:
{
EtToolbarGraphsInitializeDpi();
}
break;
}
return TRUE;
}
VOID EtRegisterToolbarGraphs(
@@ -1971,8 +1979,6 @@ VOID EtRegisterToolbarGraphs(
{
PTOOLSTATUS_INTERFACE ToolStatusInterface;
EtToolbarGraphsInitializeDpi();
if (ToolStatusInterface = PhGetPluginInterfaceZ(TOOLSTATUS_PLUGIN_NAME, TOOLSTATUS_INTERFACE_VERSION))
{
ToolStatusInterface->RegisterToolbarGraph(
@@ -1980,7 +1986,7 @@ VOID EtRegisterToolbarGraphs(
5,
L"GPU history",
EtGpuEnabled ? 0 : TOOLSTATUS_GRAPH_UNAVAILABLE,
&EtpToolbarGpuHistoryGraphContext,
NULL,
EtpToolbarGpuHistoryGraphMessageCallback
);
@@ -1989,7 +1995,7 @@ VOID EtRegisterToolbarGraphs(
6,
L"NPU history",
EtNpuEnabled ? 0 : TOOLSTATUS_GRAPH_UNAVAILABLE,
&EtpToolbarNpuHistoryGraphContext,
NULL,
EtpToolbarNpuHistoryGraphMessageCallback
);
@@ -1998,7 +2004,7 @@ VOID EtRegisterToolbarGraphs(
7,
L"Disk history",
EtEtwEnabled ? 0 : TOOLSTATUS_GRAPH_UNAVAILABLE,
&EtpToolbarDiskHistoryGraphContext,
NULL,
EtpToolbarDiskHistoryGraphMessageCallback
);
@@ -2007,15 +2013,8 @@ VOID EtRegisterToolbarGraphs(
8,
L"Network history",
EtEtwEnabled ? 0 : TOOLSTATUS_GRAPH_UNAVAILABLE,
&EtpToolbarNetworkHistoryGraphContext,
NULL,
EtpToolbarNetworkHistoryGraphMessageCallback
);
}
PhRegisterCallback(
PhGetGeneralCallback(GeneralCallbackWindowNotifyEvent),
EtMainWindowMessageEventCallback,
NULL,
&EtpMainWindowMessageEventRegistration
);
}
+8 -8
View File
@@ -61,8 +61,8 @@ VOID NpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -76,8 +76,8 @@ VOID NpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -91,8 +91,8 @@ VOID NpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -106,8 +106,8 @@ VOID NpuPropCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
+16 -16
View File
@@ -499,8 +499,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -514,8 +514,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -529,8 +529,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -546,8 +546,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -561,8 +561,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -576,8 +576,8 @@ VOID EtpCreateNpuGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
NpuDialog,
NULL,
NULL,
@@ -808,12 +808,12 @@ PPH_STRING EtpNpuTemperatureGraphLabelYFunction(
if (EtNpuFahrenheitEnabled)
{
PhInitFormatF(&format[0], (ULONG)(Value * Parameter) * 1.8 + 32, 1);
PhInitFormatF(&format[0], (Value * Parameter) * 1.8f + 32, 1);
PhInitFormatS(&format[1], L"\u00b0F");
}
else
{
PhInitFormatF(&format[0], (ULONG)(Value * Parameter), 1);
PhInitFormatF(&format[0], (Value * Parameter), 1);
PhInitFormatS(&format[1], L"\u00b0C\n");
}
@@ -829,7 +829,7 @@ PPH_STRING EtpNpuFanRpmGraphLabelYFunction(
{
PH_FORMAT format[2];
PhInitFormatU(&format[0], (ULONG)(Value * Parameter));
PhInitFormatU(&format[0], ((ULONG)Value * (ULONG)Parameter));
PhInitFormatS(&format[1], L" RPM\n");
return PhFormat(format, RTL_NUMBER_OF(format), 0);
@@ -1237,7 +1237,7 @@ VOID EtpNotifyTemperatureNpuGraph(
if (EtNpuFahrenheitEnabled)
{
PhInitFormatF(&format[0], (temp * 1.8 + 32), 1);
PhInitFormatF(&format[0], (temp * 1.8f + 32), 1);
PhInitFormatS(&format[1], L"\u00b0F\n");
PhInitFormatSR(&format[2], PH_AUTO_T(PH_STRING, PhGetStatisticsTimeString(NULL, getTooltipText->Index))->sr);
}
+2 -5
View File
@@ -149,17 +149,14 @@ BOOLEAN EtPoolTagTreeFilterCallback(
}
VOID NTAPI EtPoolMonProcessesUpdatedCallback(
_In_opt_ PVOID Parameter,
_In_ PVOID Parameter,
_In_ PVOID Context
)
{
PPOOLTAG_CONTEXT context = Context;
if (context->ProcessesUpdatedCount < 2)
{
context->ProcessesUpdatedCount++;
if (PtrToUlong(Parameter) < 3)
return;
}
EtUpdatePoolTagTable(Context);
}
-1
View File
@@ -108,7 +108,6 @@ typedef struct _POOLTAG_CONTEXT
HWND SearchboxHandle;
HWND TreeNewHandle;
PH_LAYOUT_MANAGER LayoutManager;
ULONG ProcessesUpdatedCount;
PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration;
ULONG_PTR SearchMatchHandle;
+2 -2
View File
@@ -216,10 +216,10 @@ NTSTATUS TpmOpen(
NTSTATUS TpmDeviceIoControl(
_In_ HANDLE DeviceHandle,
_In_ ULONG IoControlCode,
_In_ PVOID InputBuffer,
_In_opt_ PVOID InputBuffer,
_In_ ULONG InputBufferLength,
_In_ PVOID OutputBuffer,
_Out_opt_ PULONG OutputBufferLength
_Inout_opt_ PULONG OutputBufferLength
)
{
NTSTATUS status;
+2 -2
View File
@@ -136,12 +136,12 @@ VOID EtFormatNetworkSize(
}
VOID EtFormatDouble(
_In_ DOUBLE Value,
_In_ FLOAT Value,
_In_ PET_PROCESS_BLOCK Block,
_In_ PPH_PLUGIN_TREENEW_MESSAGE Message
)
{
if (Value >= 0.01)
if (Value >= 0.01f)
{
PH_FORMAT format[1];
+2 -2
View File
@@ -161,8 +161,8 @@ EXSTYLE WS_EX_APPWINDOW
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "NET",IDC_TITLE,0,0,72,21
RTEXT "NET",IDC_DEVICENAME,83,4,232,16,SS_WORDELLIPSIS
LTEXT "NET",IDC_TITLE,0,0,143,21
RTEXT "NET",IDC_DEVICENAME,148,4,167,16,SS_WORDELLIPSIS
LTEXT "Panel layout",IDC_PANEL_LAYOUT,0,147,315,39,NOT WS_VISIBLE
LTEXT "Graph layout",IDC_GRAPH_LAYOUT,0,22,315,111,NOT WS_VISIBLE
LTEXT "Send:",IDC_UP_L,73,0,20,8
+6 -3
View File
@@ -1397,8 +1397,8 @@ BOOLEAN DevicesTabPageCallback(
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TN_STYLE_ICONS | TN_STYLE_DOUBLE_BUFFERED | TN_STYLE_ANIMATE_DIVIDER | thinRows | treelistBorder | treelistCustomColors,
0,
0,
3,
3,
0,
0,
Parameter2,
NULL,
PluginInstance->DllBase,
@@ -1440,7 +1440,7 @@ BOOLEAN DevicesTabPageCallback(
HFONT font = (HFONT)Parameter1;
if (DeviceTreeHandle)
SendMessage(DeviceTreeHandle, WM_SETFONT, (WPARAM)Parameter1, TRUE);
SetWindowFont(DeviceTreeHandle, Parameter1, TRUE);
}
break;
case MainTabPageDpiChanged:
@@ -1530,6 +1530,9 @@ VOID NTAPI DeviceTreeProcessesUpdatedCallback(
_In_opt_ PVOID Context
)
{
if (PtrToUlong(Parameter) < 2)
return;
if (!DeviceTreeHandle)
return;
+8 -8
View File
@@ -233,11 +233,11 @@ VOID DiskDeviceQueryVolumeInfo(
PhaFormatSize(ntfsVolumeInfo.VolumeData.NumberSectors.QuadPart * ntfsVolumeInfo.VolumeData.BytesPerSector, ULONG_MAX)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_TOTAL_FREE, Column,
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize(ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * ntfsVolumeInfo.VolumeData.BytesPerCluster, ULONG_MAX)->Buffer,
(DOUBLE)(ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * 100) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
(FLOAT)(ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * 100.f) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_TOTAL_USED, Column,
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize(
(ntfsVolumeInfo.VolumeData.NumberSectors.QuadPart * ntfsVolumeInfo.VolumeData.BytesPerSector) - (ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * ntfsVolumeInfo.VolumeData.BytesPerCluster), ULONG_MAX)->Buffer,
100.0 - (DOUBLE)(ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * 100) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer); // HACK (dmex)
100.f - (FLOAT)(ntfsVolumeInfo.VolumeData.FreeClusters.QuadPart * 100) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer); // HACK (dmex)
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_TOTAL_SECTORS, Column,
PhaFormatUInt64(ntfsVolumeInfo.VolumeData.NumberSectors.QuadPart, TRUE)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_TOTAL_CLUSTERS, Column,
@@ -257,13 +257,13 @@ VOID DiskDeviceQueryVolumeInfo(
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_RECORDS, Column,
PhaFormatUInt64(ntfsVolumeInfo.VolumeData.MftValidDataLength.QuadPart / ntfsVolumeInfo.VolumeData.BytesPerFileRecordSegment, TRUE)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_SIZE, Column,
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize(ntfsVolumeInfo.VolumeData.MftValidDataLength.QuadPart, ULONG_MAX)->Buffer, ((DOUBLE)ntfsVolumeInfo.VolumeData.MftValidDataLength.QuadPart / ntfsVolumeInfo.VolumeData.BytesPerCluster * 100) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize(ntfsVolumeInfo.VolumeData.MftValidDataLength.QuadPart, ULONG_MAX)->Buffer, ((FLOAT)ntfsVolumeInfo.VolumeData.MftValidDataLength.QuadPart / ntfsVolumeInfo.VolumeData.BytesPerCluster * 100.f) / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_START, Column,
PhaFormatString(L"%I64u", ntfsVolumeInfo.VolumeData.MftStartLcn.QuadPart)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_ZONE, Column,
PhaFormatString(L"%I64u - %I64u", ntfsVolumeInfo.VolumeData.MftZoneStart.QuadPart, ntfsVolumeInfo.VolumeData.MftZoneEnd.QuadPart)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_ZONE_SIZE, Column,
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize((ntfsVolumeInfo.VolumeData.MftZoneEnd.QuadPart - ntfsVolumeInfo.VolumeData.MftZoneStart.QuadPart) * ntfsVolumeInfo.VolumeData.BytesPerCluster, ULONG_MAX)->Buffer, (DOUBLE)(ntfsVolumeInfo.VolumeData.MftZoneEnd.QuadPart - ntfsVolumeInfo.VolumeData.MftZoneStart.QuadPart) * 100 / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
PhaFormatString(L"%s (%.2f%%)", PhaFormatSize((ntfsVolumeInfo.VolumeData.MftZoneEnd.QuadPart - ntfsVolumeInfo.VolumeData.MftZoneStart.QuadPart) * ntfsVolumeInfo.VolumeData.BytesPerCluster, ULONG_MAX)->Buffer, (FLOAT)(ntfsVolumeInfo.VolumeData.MftZoneEnd.QuadPart - ntfsVolumeInfo.VolumeData.MftZoneStart.QuadPart) * 100.f / ntfsVolumeInfo.VolumeData.TotalClusters.QuadPart)->Buffer);
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_MFT_MIRROR_START, Column,
PhaFormatString(L"%I64u", ntfsVolumeInfo.VolumeData.Mft2StartLcn.QuadPart)->Buffer);
}
@@ -434,12 +434,12 @@ VOID DiskDeviceQueryFileSystem(
if (PhWindowsVersion >= WINDOWS_10)
{
LARGE_INTEGER frequency;
DOUBLE volumeTrimTime;
DOUBLE fileTrimTime;
FLOAT volumeTrimTime;
FLOAT fileTrimTime;
PhQueryPerformanceFrequency(&frequency);
volumeTrimTime = (DOUBLE)buffer->NtfsStatistics.VolumeTrimTime / (DOUBLE)frequency.QuadPart;
fileTrimTime = (DOUBLE)buffer->NtfsStatistics.FileLevelTrimTime / (DOUBLE)frequency.QuadPart;
volumeTrimTime = (FLOAT)buffer->NtfsStatistics.VolumeTrimTime / (FLOAT)frequency.QuadPart;
fileTrimTime = (FLOAT)buffer->NtfsStatistics.FileLevelTrimTime / (FLOAT)frequency.QuadPart;
PhSetListViewSubItem(Context->ListViewHandle, DISKDRIVE_DETAILS_INDEX_VOLUME_TRIM_COUNT, column,
PhaFormatUInt64(buffer->NtfsStatistics.VolumeTrimCount, TRUE)->Buffer);
+4 -4
View File
@@ -218,8 +218,8 @@ VOID DiskDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -233,8 +233,8 @@ VOID DiskDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
+3 -3
View File
@@ -247,14 +247,14 @@ VOID GraphicsDevicesUpdate(
PhQueryPerformanceCounter(&performanceCounter);
PhUpdateDelta(&entry->TotalRunningTimeDelta, performanceCounter.QuadPart);
DOUBLE elapsedTime = (DOUBLE)entry->TotalRunningTimeDelta.Delta * 10000000 / GraphicsTotalRunningTimeFrequency.QuadPart;
DOUBLE tempValue = 0.0f;
FLOAT elapsedTime = (FLOAT)entry->TotalRunningTimeDelta.Delta * 10000000 / GraphicsTotalRunningTimeFrequency.QuadPart;
FLOAT tempValue = 0.0f;
if (elapsedTime != 0)
{
for (ULONG node = 0; node < entry->NumberOfNodes; node++)
{
DOUBLE usage = (DOUBLE)(entry->TotalRunningTimeNodesDelta[node].Delta / elapsedTime);
FLOAT usage = (FLOAT)(entry->TotalRunningTimeNodesDelta[node].Delta / elapsedTime);
if (usage > 1)
usage = 1;
+2 -2
View File
@@ -158,8 +158,8 @@ INT_PTR CALLBACK GraphicsDeviceNodesDlgProc(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
hwndDlg,
NULL,
NULL,
+5 -4
View File
@@ -222,8 +222,8 @@ VOID NetworkDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -237,8 +237,8 @@ VOID NetworkDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -618,6 +618,7 @@ INT_PTR CALLBACK NetworkDeviceDialogProc(
context->AdapterNameLabel = GetDlgItem(hwndDlg, IDC_DEVICENAME);
PhInitializeLayoutManager(&context->LayoutManager, hwndDlg);
PhAddLayoutItem(&context->LayoutManager, context->AdapterTextLabel, NULL, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT | PH_LAYOUT_FORCE_INVALIDATE);
PhAddLayoutItem(&context->LayoutManager, context->AdapterNameLabel, NULL, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT | PH_LAYOUT_FORCE_INVALIDATE);
graphItem = PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_GRAPH_LAYOUT), NULL, PH_ANCHOR_ALL);
panelItem = PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_PANEL_LAYOUT), NULL, PH_ANCHOR_LEFT | PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
+9 -8
View File
@@ -89,8 +89,8 @@ VOID RaplDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -104,8 +104,8 @@ VOID RaplDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -119,8 +119,8 @@ VOID RaplDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -134,8 +134,8 @@ VOID RaplDeviceCreateGraphs(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
Context->WindowHandle,
NULL,
NULL,
@@ -377,6 +377,7 @@ PPH_STRING RaplGraphSingleLabelYFunction(
)
{
DOUBLE value = (DOUBLE)Value * (DOUBLE)Parameter;
FLOAT value = Value * Parameter;
if (value != 0)
{
+11 -15
View File
@@ -193,10 +193,10 @@ VOID NTAPI MenuItemCallback(
PPH_STRING selectedChoice = NULL;
PH_IP_ENDPOINT remoteEndpoint = { 0 };
while (PhaChoiceDialog(
while (PhChoiceDialog(
menuItem->OwnerWindow,
L"Ping",
L"Hostname or IP address:",
L"Ping the Hostname or IP Address",
L"You can use an IPv4 or IPv6 address as the target or a fully qualified domain name (FQDN) or a website URL as the target.",
NULL,
0,
NULL,
@@ -219,10 +219,10 @@ VOID NTAPI MenuItemCallback(
PPH_STRING selectedChoice = NULL;
PH_IP_ENDPOINT remoteEndpoint = { 0 };
while (PhaChoiceDialog(
while (PhChoiceDialog(
menuItem->OwnerWindow,
L"Tracert",
L"Hostname or IP address:",
L"Tracert the Hostname or IP Address",
L"You can use an IPv4 or IPv6 address as the target or a fully qualified domain name (FQDN) or a website URL as the target.",
NULL,
0,
NULL,
@@ -245,10 +245,10 @@ VOID NTAPI MenuItemCallback(
PPH_STRING selectedChoice = NULL;
PH_IP_ENDPOINT remoteEndpoint = { 0 };
while (PhaChoiceDialog(
while (PhChoiceDialog(
menuItem->OwnerWindow,
L"Whois",
L"Hostname or IP address:",
L"Whois the Hostname or IP Address",
L"You can use an IPv4 or IPv6 address as the target or a fully qualified domain name (FQDN) or a website URL as the target.",
NULL,
0,
NULL,
@@ -830,21 +830,17 @@ BOOLEAN NetworkToolsGeoIpFlushCache(
}
VOID ProcessesUpdatedCallback(
_In_opt_ PVOID Parameter,
_In_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
static ULONG ProcessesUpdatedCount = 0;
PLIST_ENTRY listEntry;
if (!NetworkExtensionEnabled)
return;
if (ProcessesUpdatedCount != 3)
{
ProcessesUpdatedCount++;
if (PtrToUlong(Parameter) < 3)
return;
}
NetworkToolsGeoIpFlushCache();
+1 -1
View File
@@ -202,7 +202,7 @@ VOID ShowDbCheckForUpdatesDialog(
config.pszWindowTitle = L"Network Tools - GeoLite Updater";
config.pszMainInstruction = L"Download the latest GeoLite database?";
config.pszContent = L"This product includes GeoLite2 data created by MaxMind, available from <a href=\"http://www.maxmind.com\">http://www.maxmind.com</a>\r\n\r\nSelect download to continue.";
config.pszContent = L"This product includes GeoLite2 data created by MaxMind, available from <a href=\"https://www.maxmind.com\">https://www.maxmind.com</a>\r\n\r\nSelect download to continue.";
TaskDialogNavigatePage(Context->DialogHandle, &config);
}
+4 -4
View File
@@ -319,9 +319,9 @@ PPH_STRING NetworkPingLabelYFunction(
_In_ FLOAT Parameter
)
{
DOUBLE value;
FLOAT value;
value = (DOUBLE)(Parameter);
value = (FLOAT)(Parameter);
if (value != 0)
{
@@ -386,8 +386,8 @@ INT_PTR CALLBACK NetworkPingWndProc(
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
0,
0,
hwndDlg,
NULL,
NULL,
+14 -4
View File
@@ -382,21 +382,31 @@ PPH_STRING UpdateWindowsString(
PVOID imageBase;
ULONG imageSize;
PVOID versionInfo;
VS_FIXEDFILEINFO* rootBlock;
if (NT_SUCCESS(PhGetKernelFileNameEx(&fileName, &imageBase, &imageSize)))
{
if (NT_SUCCESS(PhLoadMappedImageHeaderPageSize(&fileName->sr, NULL, &mappedImage)))
{
imageMachine = mappedImage.NtHeaders->FileHeader.Machine;
timeDateStamp = mappedImage.NtHeaders->FileHeader.TimeDateStamp;
sizeOfImage = mappedImage.NtHeaders->OptionalHeader.SizeOfImage;
if (mappedImage.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{
imageMachine = mappedImage.NtHeaders32->FileHeader.Machine;
timeDateStamp = mappedImage.NtHeaders32->FileHeader.TimeDateStamp;
sizeOfImage = mappedImage.NtHeaders32->OptionalHeader.SizeOfImage;
}
else if (mappedImage.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
{
imageMachine = mappedImage.NtHeaders->FileHeader.Machine;
timeDateStamp = mappedImage.NtHeaders->FileHeader.TimeDateStamp;
sizeOfImage = mappedImage.NtHeaders->OptionalHeader.SizeOfImage;
}
PhUnloadMappedImage(&mappedImage);
}
if (versionInfo = PhGetFileVersionInfoEx(&fileName->sr))
{
VS_FIXEDFILEINFO* rootBlock;
if (rootBlock = PhGetFileVersionFixedInfo(versionInfo))
{
PH_FORMAT format[5];
+5 -5
View File
@@ -60,7 +60,7 @@ VOID NTAPI MenuItemCallback(
WE_WINDOW_SELECTOR selector;
selector.Type = WeWindowSelectorAll;
WeShowWindowsDialog(WeGetMainWindowHandle(), &selector);
WeShowWindowsDialog(menuItem->OwnerWindow, &selector);
}
break;
case ID_VIEW_DESKTOPWINDOWS:
@@ -72,7 +72,7 @@ VOID NTAPI MenuItemCallback(
EnumDesktops(GetProcessWindowStation(), WepEnumDesktopProc, (LPARAM)desktopNames);
if (PhaChoiceDialog(
WeGetMainWindowHandle(),
menuItem->OwnerWindow,
L"Desktop Windows",
L"Display windows for the following desktop:",
(PWSTR *)desktopNames->Items,
@@ -88,7 +88,7 @@ VOID NTAPI MenuItemCallback(
selector.Type = WeWindowSelectorDesktop;
PhSetReference(&selector.Desktop.DesktopName, selectedChoice);
WeShowWindowsDialog(WeGetMainWindowHandle(), &selector);
WeShowWindowsDialog(menuItem->OwnerWindow, &selector);
}
}
break;
@@ -98,7 +98,7 @@ VOID NTAPI MenuItemCallback(
selector.Type = WeWindowSelectorProcess;
selector.Process.ProcessId = ((PPH_PROCESS_ITEM)menuItem->Context)->ProcessId;
WeShowWindowsDialog(WeGetMainWindowHandle(), &selector);
WeShowWindowsDialog(menuItem->OwnerWindow, &selector);
}
break;
case ID_THREAD_WINDOWS:
@@ -107,7 +107,7 @@ VOID NTAPI MenuItemCallback(
selector.Type = WeWindowSelectorThread;
selector.Thread.ThreadId = ((PPH_THREAD_ITEM)menuItem->Context)->ThreadId;
WeShowWindowsDialog(WeGetMainWindowHandle(), &selector);
WeShowWindowsDialog(menuItem->OwnerWindow, &selector);
}
break;
}
+30 -13
View File
@@ -51,24 +51,22 @@ typedef PTOOLSTATUS_TAB_INFO (NTAPI *PTOOLSTATUS_REGISTER_TAB_INFO)(
#define TOOLSTATUS_GRAPH_ENABLED 0x1
#define TOOLSTATUS_GRAPH_UNAVAILABLE 0x2
typedef struct _PH_TOOLBAR_GRAPH* PPH_TOOLBAR_GRAPH;
typedef struct _PH_PLUGIN* PPH_PLUGIN;
#define TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(ToolStatusGraphCallbackName) \
VOID ToolStatusGraphCallbackName( \
_In_ PPH_TOOLBAR_GRAPH Graph, \
_In_ HWND GraphHandle, \
_In_ PPH_GRAPH_STATE GraphState, \
_In_ LPNMHDR Header, \
_In_ PVOID Context \
)
typedef BOOLEAN (NTAPI *PTOOLSTATUS_GRAPH_CALLBACK)(
_In_ HWND WindowHandle,
_In_ ULONG Message,
_In_ PVOID Parameter1,
_In_ PVOID Parameter2,
_In_ PVOID Context
);
typedef VOID (NTAPI *PTOOLSTATUS_GRAPH_MESSAGE_CALLBACK)(
_In_ PPH_TOOLBAR_GRAPH Graph,
_In_ PVOID Graph,
_In_ HWND GraphHandle,
_In_ PPH_GRAPH_STATE GraphState,
_In_ LPNMHDR Header,
_In_opt_ PVOID Context
_In_ PVOID Context
);
typedef VOID (NTAPI *PTOOLSTATUS_REGISTER_TOOLBAR_GRAPH)(
@@ -76,10 +74,29 @@ typedef VOID (NTAPI *PTOOLSTATUS_REGISTER_TOOLBAR_GRAPH)(
_In_ ULONG Id,
_In_ PWSTR Text,
_In_ ULONG Flags,
_In_opt_ PVOID Context,
_In_opt_ PTOOLSTATUS_GRAPH_MESSAGE_CALLBACK MessageCallback
_In_ PVOID Context,
_In_ PTOOLSTATUS_GRAPH_CALLBACK Callback
);
typedef struct _PH_TOOLBAR_GRAPH
{
PPH_PLUGIN Plugin;
ULONG Flags;
ULONG GraphId;
LONG GraphDpi;
ULONG GraphColor1;
ULONG GraphColor2;
HWND GraphHandle;
PVOID Context;
PWSTR Text;
PH_GRAPH_STATE GraphState;
PTOOLSTATUS_GRAPH_MESSAGE_CALLBACK MessageCallback;
PTOOLSTATUS_GRAPH_CALLBACK GraphCallback;
} PH_TOOLBAR_GRAPH, *PPH_TOOLBAR_GRAPH;
typedef struct _TOOLSTATUS_INTERFACE
{
ULONG Version;