@@ -61,14 +61,6 @@ VOID PhpRemoveProcessNode(
61
61
_In_ PPH_PROCESS_NODE ProcessNode
62
62
);
63
63
64
- VOID PhpUpdateNeedCyclesInformation (
65
- VOID
66
- );
67
-
68
- VOID PhpUpdateProcessNodeCycles (
69
- _Inout_ PPH_PROCESS_NODE ProcessNode
70
- );
71
-
72
64
LONG PhpProcessTreeNewPostSortFunction (
73
65
_In_ LONG Result ,
74
66
_In_ PVOID Node1 ,
@@ -92,13 +84,11 @@ static PH_CM_MANAGER ProcessTreeListCm;
92
84
static PPH_HASH_ENTRY ProcessNodeHashSet [256 ] = PH_HASH_SET_INIT ; // hashtable of all nodes
93
85
static PPH_LIST ProcessNodeList ; // list of all nodes, used when sorting is enabled
94
86
static PPH_LIST ProcessNodeRootList ; // list of root nodes
87
+ static PH_TN_FILTER_SUPPORT FilterSupport ;
95
88
96
89
BOOLEAN PhProcessTreeListStateHighlighting = TRUE;
97
90
static PPH_POINTER_LIST ProcessNodeStateList = NULL ; // list of nodes which need to be processed
98
91
99
- static PH_TN_FILTER_SUPPORT FilterSupport ;
100
- static BOOLEAN NeedCyclesInformation = FALSE;
101
-
102
92
static HDC GraphContext = NULL ;
103
93
static ULONG GraphContextWidth = 0 ;
104
94
static ULONG GraphContextHeight = 0 ;
@@ -254,8 +244,6 @@ VOID PhLoadSettingsProcessTreeList(
254
244
{
255
245
SendMessage (TreeNew_GetTooltips (ProcessTreeListHandle ), TTM_SETDELAYTIME , TTDT_INITIAL , 0 );
256
246
}
257
-
258
- PhpUpdateNeedCyclesInformation ();
259
247
}
260
248
261
249
VOID PhSaveSettingsProcessTreeList (
@@ -624,10 +612,6 @@ VOID PhTickProcessNodes(
624
612
node -> CpuGraphBuffers .Valid = FALSE;
625
613
node -> PrivateGraphBuffers .Valid = FALSE;
626
614
node -> IoGraphBuffers .Valid = FALSE;
627
-
628
- // Updates cycles if necessary.
629
- if (NeedCyclesInformation )
630
- PhpUpdateProcessNodeCycles (node );
631
615
}
632
616
633
617
fullyInvalidated = FALSE;
@@ -986,17 +970,17 @@ static VOID PhpUpdateProcessOsContext(
986
970
{
987
971
if (NT_SUCCESS (PhGetProcessSwitchContext (processHandle , & ProcessNode -> OsContextGuid )))
988
972
{
989
- if (memcmp (& ProcessNode -> OsContextGuid , & WINTHRESHOLD_CONTEXT_GUID , sizeof ( GUID )) == 0 )
973
+ if (IsEqualGUID (& ProcessNode -> OsContextGuid , & WINTHRESHOLD_CONTEXT_GUID ) )
990
974
ProcessNode -> OsContextVersion = WINDOWS_10 ;
991
- else if (memcmp (& ProcessNode -> OsContextGuid , & WINBLUE_CONTEXT_GUID , sizeof ( GUID )) == 0 )
975
+ else if (IsEqualGUID (& ProcessNode -> OsContextGuid , & WINBLUE_CONTEXT_GUID ) )
992
976
ProcessNode -> OsContextVersion = WINDOWS_8_1 ;
993
- else if (memcmp (& ProcessNode -> OsContextGuid , & WIN8_CONTEXT_GUID , sizeof ( GUID )) == 0 )
977
+ else if (IsEqualGUID (& ProcessNode -> OsContextGuid , & WIN8_CONTEXT_GUID ) )
994
978
ProcessNode -> OsContextVersion = WINDOWS_8 ;
995
- else if (memcmp (& ProcessNode -> OsContextGuid , & WIN7_CONTEXT_GUID , sizeof ( GUID )) == 0 )
979
+ else if (IsEqualGUID (& ProcessNode -> OsContextGuid , & WIN7_CONTEXT_GUID ) )
996
980
ProcessNode -> OsContextVersion = WINDOWS_7 ;
997
- else if (memcmp (& ProcessNode -> OsContextGuid , & VISTA_CONTEXT_GUID , sizeof ( GUID )) == 0 )
981
+ else if (IsEqualGUID (& ProcessNode -> OsContextGuid , & VISTA_CONTEXT_GUID ) )
998
982
ProcessNode -> OsContextVersion = WINDOWS_VISTA ;
999
- else if (memcmp (& ProcessNode -> OsContextGuid , & XP_CONTEXT_GUID , sizeof ( GUID )) == 0 )
983
+ else if (IsEqualGUID (& ProcessNode -> OsContextGuid , & XP_CONTEXT_GUID ) )
1000
984
ProcessNode -> OsContextVersion = WINDOWS_XP ;
1001
985
}
1002
986
@@ -1182,91 +1166,6 @@ static VOID PhpUpdateProcessNodeFileAttributes(
1182
1166
}
1183
1167
}
1184
1168
1185
- static VOID PhpUpdateNeedCyclesInformation (
1186
- VOID
1187
- )
1188
- {
1189
- PH_TREENEW_COLUMN column ;
1190
-
1191
- NeedCyclesInformation = FALSE;
1192
-
1193
- // Before Windows Vista, there is no cycle time measurement.
1194
- // On Windows 7 and above, cycle time information is available directly from the process item.
1195
- // We only need to query cycle time separately for Windows Vista.
1196
- if (WindowsVersion != WINDOWS_VISTA )
1197
- return ;
1198
-
1199
- TreeNew_GetColumn (ProcessTreeListHandle , PHPRTLC_CYCLES , & column );
1200
-
1201
- if (column .Visible )
1202
- {
1203
- NeedCyclesInformation = TRUE;
1204
- return ;
1205
- }
1206
-
1207
- TreeNew_GetColumn (ProcessTreeListHandle , PHPRTLC_CYCLESDELTA , & column );
1208
-
1209
- if (column .Visible )
1210
- {
1211
- NeedCyclesInformation = TRUE;
1212
- return ;
1213
- }
1214
- }
1215
-
1216
- static VOID PhpUpdateProcessNodeCycles (
1217
- _Inout_ PPH_PROCESS_NODE ProcessNode
1218
- )
1219
- {
1220
- if (ProcessNode -> ProcessId == SYSTEM_IDLE_PROCESS_ID )
1221
- {
1222
- PULARGE_INTEGER idleThreadCycleTimes ;
1223
- ULONG64 cycleTime ;
1224
- ULONG i ;
1225
-
1226
- // System Idle Process requires special treatment.
1227
-
1228
- idleThreadCycleTimes = PhAllocate (
1229
- sizeof (ULARGE_INTEGER ) * (ULONG )PhSystemBasicInformation .NumberOfProcessors
1230
- );
1231
-
1232
- if (NT_SUCCESS (NtQuerySystemInformation (
1233
- SystemProcessorIdleCycleTimeInformation ,
1234
- idleThreadCycleTimes ,
1235
- sizeof (ULARGE_INTEGER ) * (ULONG )PhSystemBasicInformation .NumberOfProcessors ,
1236
- NULL
1237
- )))
1238
- {
1239
- cycleTime = 0 ;
1240
-
1241
- for (i = 0 ; i < (ULONG )PhSystemBasicInformation .NumberOfProcessors ; i ++ )
1242
- cycleTime += idleThreadCycleTimes [i ].QuadPart ;
1243
-
1244
- PhUpdateDelta (& ProcessNode -> CyclesDelta , cycleTime );
1245
- }
1246
-
1247
- PhFree (idleThreadCycleTimes );
1248
- }
1249
- else if (ProcessNode -> ProcessItem -> QueryHandle )
1250
- {
1251
- ULONG64 cycleTime ;
1252
-
1253
- if (NT_SUCCESS (PhGetProcessCycleTime (ProcessNode -> ProcessItem -> QueryHandle , & cycleTime )))
1254
- {
1255
- PhUpdateDelta (& ProcessNode -> CyclesDelta , cycleTime );
1256
- }
1257
- }
1258
-
1259
- if (ProcessNode -> CyclesDelta .Value != 0 )
1260
- PhMoveReference (& ProcessNode -> CyclesText , PhFormatUInt64 (ProcessNode -> CyclesDelta .Value , TRUE));
1261
- else
1262
- PhClearReference (& ProcessNode -> CyclesText );
1263
-
1264
- if (ProcessNode -> CyclesDelta .Delta != 0 )
1265
- PhMoveReference (& ProcessNode -> CyclesDeltaText , PhFormatUInt64 (ProcessNode -> CyclesDelta .Delta , TRUE));
1266
- else
1267
- PhClearReference (& ProcessNode -> CyclesDeltaText );
1268
- }
1269
-
1270
1169
#define SORT_FUNCTION (Column ) PhpProcessTreeNewCompare##Column
1271
1170
1272
1171
#define BEGIN_SORT_FUNCTION (Column ) static int __cdecl PhpProcessTreeNewCompare##Column( \
@@ -1411,14 +1310,6 @@ BEGIN_SORT_FUNCTION(PeakWorkingSet)
1411
1310
END_SORT_FUNCTION
1412
1311
1413
1312
BEGIN_SORT_FUNCTION (PrivateWs )
1414
- {
1415
- PhpUpdateProcessNodeWsCounters (node1 );
1416
- PhpUpdateProcessNodeWsCounters (node2 );
1417
- sortResult = uintptrcmp (node1 -> WsCounters .NumberOfPrivatePages , node2 -> WsCounters .NumberOfPrivatePages );
1418
- }
1419
- END_SORT_FUNCTION
1420
-
1421
- BEGIN_SORT_FUNCTION (PrivateWsWin7 )
1422
1313
{
1423
1314
sortResult = uintptrcmp (processItem1 -> WorkingSetPrivateSize , processItem2 -> WorkingSetPrivateSize );
1424
1315
}
@@ -1661,24 +1552,12 @@ BEGIN_SORT_FUNCTION(WindowStatus)
1661
1552
END_SORT_FUNCTION
1662
1553
1663
1554
BEGIN_SORT_FUNCTION (Cycles )
1664
- {
1665
- sortResult = uint64cmp (node1 -> CyclesDelta .Value , node2 -> CyclesDelta .Value );
1666
- }
1667
- END_SORT_FUNCTION
1668
-
1669
- BEGIN_SORT_FUNCTION (CyclesWin7 )
1670
1555
{
1671
1556
sortResult = uint64cmp (processItem1 -> CycleTimeDelta .Value , processItem2 -> CycleTimeDelta .Value );
1672
1557
}
1673
1558
END_SORT_FUNCTION
1674
1559
1675
1560
BEGIN_SORT_FUNCTION (CyclesDelta )
1676
- {
1677
- sortResult = uint64cmp (node1 -> CyclesDelta .Delta , node2 -> CyclesDelta .Delta );
1678
- }
1679
- END_SORT_FUNCTION
1680
-
1681
- BEGIN_SORT_FUNCTION (CyclesDeltaWin7 )
1682
1561
{
1683
1562
sortResult = uint64cmp (processItem1 -> CycleTimeDelta .Delta , processItem2 -> CycleTimeDelta .Delta );
1684
1563
}
@@ -2011,19 +1890,8 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
2011
1890
SORT_FUNCTION (FileModifiedTime ),
2012
1891
SORT_FUNCTION (FileSize )
2013
1892
};
2014
- static PH_INITONCE initOnce = PH_INITONCE_INIT ;
2015
1893
int (__cdecl * sortFunction )(const void * , const void * );
2016
1894
2017
- if (PhBeginInitOnce (& initOnce ))
2018
- {
2019
- // TODO: Remove this.
2020
- sortFunctions [PHPRTLC_PRIVATEWS ] = SORT_FUNCTION (PrivateWsWin7 );
2021
- sortFunctions [PHPRTLC_CYCLES ] = SORT_FUNCTION (CyclesWin7 );
2022
- sortFunctions [PHPRTLC_CYCLESDELTA ] = SORT_FUNCTION (CyclesDeltaWin7 );
2023
-
2024
- PhEndInitOnce (& initOnce );
2025
- }
2026
-
2027
1895
if (!PhCmForwardSort (
2028
1896
(PPH_TREENEW_NODE * )ProcessNodeList -> Items ,
2029
1897
ProcessNodeList -> Count ,
@@ -2183,15 +2051,7 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
2183
2051
getCellText -> Text = node -> PeakWorkingSetText -> sr ;
2184
2052
break ;
2185
2053
case PHPRTLC_PRIVATEWS :
2186
- if (WindowsVersion >= WINDOWS_7 )
2187
- {
2188
- PhMoveReference (& node -> PrivateWsText , PhFormatSize (processItem -> WorkingSetPrivateSize , -1 ));
2189
- }
2190
- else
2191
- {
2192
- PhpUpdateProcessNodeWsCounters (node );
2193
- PhMoveReference (& node -> PrivateWsText , PhFormatSize ((ULONG64 )node -> WsCounters .NumberOfPrivatePages * PAGE_SIZE , -1 ));
2194
- }
2054
+ PhMoveReference (& node -> PrivateWsText , PhFormatSize (processItem -> WorkingSetPrivateSize , -1 ));
2195
2055
getCellText -> Text = node -> PrivateWsText -> sr ;
2196
2056
break ;
2197
2057
case PHPRTLC_SHAREDWS :
@@ -3101,11 +2961,8 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
3101
2961
3102
2962
data .Selection = PhShowEMenu (data .Menu , hwnd , PH_EMENU_SHOW_LEFTRIGHT ,
3103
2963
PH_ALIGN_LEFT | PH_ALIGN_TOP , data .MouseEvent -> ScreenLocation .x , data .MouseEvent -> ScreenLocation .y );
3104
- PhHandleTreeNewColumnMenu (& data );
3105
-
3106
- if (data .ProcessedId == PH_TN_COLUMN_MENU_HIDE_COLUMN_ID || data .ProcessedId == PH_TN_COLUMN_MENU_CHOOSE_COLUMNS_ID )
3107
- PhpUpdateNeedCyclesInformation ();
3108
2964
2965
+ PhHandleTreeNewColumnMenu (& data );
3109
2966
PhDeleteTreeNewColumnMenu (& data );
3110
2967
}
3111
2968
return TRUE;
0 commit comments