61 _In_opt_ PVOID Parameter1,
62 _In_opt_ PVOID Parameter2,
63 _In_opt_ PVOID Context
66 static HWND ProcessTreeListHandle;
67 static ULONG ProcessTreeListSortColumn;
79 static BOOLEAN NeedCyclesInformation =
FALSE;
81 static HDC GraphContext = NULL;
82 static ULONG GraphContextWidth = 0;
83 static ULONG GraphContextHeight = 0;
84 static HBITMAP GraphOldBitmap;
85 static HBITMAP GraphBitmap = NULL;
86 static PVOID GraphBits = NULL;
100 ProcessTreeListHandle = hwnd;
103 SendMessage(
TreeNew_GetTooltips(ProcessTreeListHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT);
209 treeNewInfo.
CmData = &ProcessTreeListCm;
231 SendMessage(
TreeNew_GetTooltips(ProcessTreeListHandle), TTM_SETDELAYTIME, TTDT_INITIAL, 0);
244 settings =
PhCmSaveSettingsEx(ProcessTreeListHandle, &ProcessTreeListCm, 0, &sortSettings);
263 return &FilterSupport;
271 return Value1->ProcessId == Value2->ProcessId;
278 return (ULONG)Value->ProcessId / 4;
288 Parent->ProcessItem->CreateTime.QuadPart <= Child->ProcessItem->CreateTime.QuadPart;
309 &ProcessNodeStateList,
316 processNode->
ProcessId = ProcessItem->ProcessId;
333 processNode->
Parent = parentNode;
338 processNode->
Parent = NULL;
344 for (i = 0; i < ProcessNodeRootList->
Count; i++)
349 node != processNode &&
354 node->
Parent = processNode;
363 PhFindItemList(ProcessNodeRootList, processNode->
Children->
Items[i])
378 static BOOLEAN servicesFound =
FALSE;
383 if (!servicesFileName)
394 ProcessItem->FileName &&
400 servicesFileName = NULL;
401 servicesFound =
TRUE;
434 for (; entry; entry = entry->
Next)
456 &ProcessNode->ShState,
457 &ProcessNodeStateList,
460 ProcessTreeListHandle
478 if (ProcessNode->Parent)
482 if ((index = PhFindItemList(ProcessNode->Parent->Children, ProcessNode)) != -1)
489 if ((index = PhFindItemList(ProcessNodeRootList, ProcessNode)) != -1)
494 for (i = 0; i < ProcessNode->Children->Count; i++)
504 if ((index = PhFindItemList(ProcessNodeList, ProcessNode)) != -1)
516 if (ProcessNode->PeakPrivateBytesText)
PhDereferenceObject(ProcessNode->PeakPrivateBytesText);
523 if (ProcessNode->PeakVirtualSizeText)
PhDereferenceObject(ProcessNode->PeakVirtualSizeText);
528 if (ProcessNode->RelativeStartTimeText)
PhDereferenceObject(ProcessNode->RelativeStartTimeText);
532 if (ProcessNode->ContextSwitchesText)
PhDereferenceObject(ProcessNode->ContextSwitchesText);
533 if (ProcessNode->ContextSwitchesDeltaText)
PhDereferenceObject(ProcessNode->ContextSwitchesDeltaText);
534 if (ProcessNode->PageFaultsDeltaText)
PhDereferenceObject(ProcessNode->PageFaultsDeltaText);
542 if (ProcessNode->PeakNonPagedPoolText)
PhDereferenceObject(ProcessNode->PeakNonPagedPoolText);
543 if (ProcessNode->MinimumWorkingSetText)
PhDereferenceObject(ProcessNode->MinimumWorkingSetText);
544 if (ProcessNode->MaximumWorkingSetText)
PhDereferenceObject(ProcessNode->MaximumWorkingSetText);
545 if (ProcessNode->PrivateBytesDeltaText)
PhDereferenceObject(ProcessNode->PrivateBytesDeltaText);
564 if (ProcessNode->TooltipText)
567 ProcessNode->TooltipText = NULL;
580 BOOLEAN fullyInvalidated;
585 for (i = 0; i < ProcessNodeList->
Count; i++)
599 if (NeedCyclesInformation)
603 fullyInvalidated =
FALSE;
609 fullyInvalidated =
TRUE;
615 if (!fullyInvalidated)
625 InvalidateRect(ProcessTreeListHandle, &rect,
FALSE);
629 static VOID PhpNeedGraphContext(
635 BITMAPINFOHEADER header;
638 if (GraphContextWidth == Width && GraphContextHeight == Height)
645 SelectObject(GraphContext, GraphBitmap);
646 DeleteObject(GraphBitmap);
647 DeleteDC(GraphContext);
654 GraphContext = CreateCompatibleDC(hdc);
656 memset(&header, 0,
sizeof(BITMAPINFOHEADER));
657 header.biSize =
sizeof(BITMAPINFOHEADER);
658 header.biWidth = Width;
659 header.biHeight = Height;
661 header.biBitCount = 32;
662 GraphBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&header, DIB_RGB_COLORS, &GraphBits, NULL, 0);
663 GraphOldBitmap = SelectObject(GraphContext, GraphBitmap);
666 static BOOLEAN PhpFormatInt32GroupDigits(
668 _Out_writes_bytes_(BufferLength) PWCHAR Buffer,
669 _In_ ULONG BufferLength,
683 String->Buffer = Buffer;
684 String->Length = returnLength -
sizeof(WCHAR);
695 static FLOAT PhpCalculateInclusiveCpuUsage(
702 cpuUsage = ProcessNode->ProcessItem->CpuUsage;
704 for (i = 0; i < ProcessNode->Children->Count; i++)
706 cpuUsage += PhpCalculateInclusiveCpuUsage(ProcessNode->Children->Items[i]);
712 static VOID PhpUpdateProcessNodeWsCounters(
718 BOOLEAN success =
FALSE;
719 HANDLE processHandle;
724 ProcessNode->ProcessItem->ProcessId
729 &ProcessNode->WsCounters
733 NtClose(processHandle);
743 static VOID PhpUpdateProcessNodeGdiUserHandles(
749 if (ProcessNode->ProcessItem->QueryHandle)
751 ProcessNode->GdiHandles = GetGuiResources(ProcessNode->ProcessItem->QueryHandle, GR_GDIOBJECTS);
752 ProcessNode->UserHandles = GetGuiResources(ProcessNode->ProcessItem->QueryHandle, GR_USEROBJECTS);
756 ProcessNode->GdiHandles = 0;
757 ProcessNode->UserHandles = 0;
764 static VOID PhpUpdateProcessNodeIoPagePriority(
770 if (ProcessNode->ProcessItem->QueryHandle)
773 ProcessNode->IoPriority = -1;
775 ProcessNode->PagePriority = -1;
779 ProcessNode->IoPriority = -1;
780 ProcessNode->PagePriority = -1;
787 static VOID PhpUpdateProcessNodeWindow(
793 ProcessNode->WindowHandle =
PhGetProcessMainWindow(ProcessNode->ProcessId, ProcessNode->ProcessItem->QueryHandle);
797 if (ProcessNode->WindowHandle)
800 ProcessNode->WindowHung = !!IsHungAppWindow(ProcessNode->WindowHandle);
807 static VOID PhpUpdateProcessNodeDepStatus(
813 HANDLE processHandle;
819 if (ProcessNode->ProcessItem->IsWow64)
827 ProcessNode->ProcessItem->ProcessId
831 NtClose(processHandle);
836 if (ProcessNode->ProcessItem->QueryHandle)
840 ProcessNode->DepStatus = depStatus;
846 static VOID PhpUpdateProcessNodeToken(
854 ProcessNode->VirtualizationAllowed =
FALSE;
855 ProcessNode->VirtualizationEnabled =
FALSE;
862 ProcessNode->ProcessItem->QueryHandle
866 ProcessNode->VirtualizationAllowed)
870 ProcessNode->VirtualizationAllowed =
FALSE;
874 NtClose(tokenHandle);
882 static VOID PhpUpdateProcessOsContext(
888 HANDLE processHandle;
898 else if (memcmp(&ProcessNode->OsContextGuid, &
WIN8_CONTEXT_GUID,
sizeof(GUID)) == 0)
899 ProcessNode->OsContextVersion =
WINDOWS_8;
900 else if (memcmp(&ProcessNode->OsContextGuid, &
WIN7_CONTEXT_GUID,
sizeof(GUID)) == 0)
901 ProcessNode->OsContextVersion =
WINDOWS_7;
904 else if (memcmp(&ProcessNode->OsContextGuid, &
XP_CONTEXT_GUID,
sizeof(GUID)) == 0)
908 NtClose(processHandle);
916 static VOID PhpUpdateProcessNodeQuotaLimits(
922 QUOTA_LIMITS quotaLimits;
924 if (ProcessNode->ProcessItem->QueryHandle &&
NT_SUCCESS(NtQueryInformationProcess(
925 ProcessNode->ProcessItem->QueryHandle,
928 sizeof(QUOTA_LIMITS),
932 ProcessNode->MinimumWorkingSetSize = quotaLimits.MinimumWorkingSetSize;
933 ProcessNode->MaximumWorkingSetSize = quotaLimits.MaximumWorkingSetSize;
937 ProcessNode->MinimumWorkingSetSize = 0;
938 ProcessNode->MaximumWorkingSetSize = 0;
945 static VOID PhpUpdateProcessNodeImage(
951 HANDLE processHandle;
952 PROCESS_BASIC_INFORMATION basicInfo;
953 PVOID imageBaseAddress;
970 ProcessNode->ImageCharacteristics = mappedImage.
NtHeaders->FileHeader.Characteristics;
972 if (mappedImage.
Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
974 ProcessNode->ImageSubsystem = ((PIMAGE_OPTIONAL_HEADER32)&mappedImage.
NtHeaders->OptionalHeader)->Subsystem;
975 ProcessNode->ImageDllCharacteristics = ((PIMAGE_OPTIONAL_HEADER32)&mappedImage.
NtHeaders->OptionalHeader)->DllCharacteristics;
977 else if (mappedImage.
Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
979 ProcessNode->ImageSubsystem = ((PIMAGE_OPTIONAL_HEADER64)&mappedImage.
NtHeaders->OptionalHeader)->Subsystem;
980 ProcessNode->ImageDllCharacteristics = ((PIMAGE_OPTIONAL_HEADER64)&mappedImage.
NtHeaders->OptionalHeader)->DllCharacteristics;
988 NtClose(processHandle);
995 static VOID PhpUpdateProcessNodeAppId(
1001 HANDLE processHandle;
1026 if (windowFlags & STARTF_TITLEISAPPID)
1027 ProcessNode->AppIdText = windowTitle;
1032 NtClose(processHandle);
1039 static VOID PhpUpdateProcessNodeDpiAwareness(
1044 static BOOL (WINAPI *getProcessDpiAwarenessInternal)(
1045 _In_ HANDLE hprocess,
1051 getProcessDpiAwarenessInternal =
PhGetModuleProcAddress(L
"user32.dll",
"GetProcessDpiAwarenessInternal");
1055 if (!getProcessDpiAwarenessInternal)
1060 if (ProcessNode->ProcessItem->QueryHandle)
1064 if (getProcessDpiAwarenessInternal(ProcessNode->ProcessItem->QueryHandle, &dpiAwareness))
1065 ProcessNode->DpiAwareness = dpiAwareness + 1;
1078 NeedCyclesInformation =
FALSE;
1090 NeedCyclesInformation =
TRUE;
1098 NeedCyclesInformation =
TRUE;
1109 PULARGE_INTEGER idleThreadCycleTimes;
1115 idleThreadCycleTimes = PhAllocate(
1121 idleThreadCycleTimes,
1129 cycleTime += idleThreadCycleTimes[i].QuadPart;
1134 PhFree(idleThreadCycleTimes);
1136 else if (ProcessNode->ProcessItem->QueryHandle)
1146 if (ProcessNode->CyclesDelta.Value != 0)
1151 if (ProcessNode->CyclesDelta.Delta != 0)
1157 #define SORT_FUNCTION(Column) PhpProcessTreeNewCompare##Column
1159 #define BEGIN_SORT_FUNCTION(Column) static int __cdecl PhpProcessTreeNewCompare##Column( \
1160 _In_ const void *_elem1, \
1161 _In_ const void *_elem2 \
1164 PPH_PROCESS_NODE node1 = *(PPH_PROCESS_NODE *)_elem1; \
1165 PPH_PROCESS_NODE node2 = *(PPH_PROCESS_NODE *)_elem2; \
1166 PPH_PROCESS_ITEM processItem1 = node1->ProcessItem; \
1167 PPH_PROCESS_ITEM processItem2 = node2->ProcessItem; \
1170 #define END_SORT_FUNCTION \
1171 if (sortResult == 0) \
1172 sortResult = intptrcmp((LONG_PTR)processItem1->ProcessId, (LONG_PTR)processItem2->ProcessId); \
1174 return PhModifySort(sortResult, ProcessTreeListSortOrder); \
1199 sortResult =
intptrcmp((LONG_PTR)processItem1->ProcessId, (LONG_PTR)processItem2->ProcessId);
1205 sortResult =
singlecmp(processItem1->CpuUsage, processItem2->CpuUsage);
1212 processItem1->IoReadDelta.Delta + processItem1->IoWriteDelta.Delta + processItem1->IoOtherDelta.Delta,
1213 processItem2->IoReadDelta.Delta + processItem2->IoWriteDelta.Delta + processItem2->IoOtherDelta.Delta
1220 sortResult =
uintptrcmp(processItem1->VmCounters.PagefileUsage, processItem2->VmCounters.PagefileUsage);
1235 sr1 = processItem1->VersionInfo.FileDescription ? processItem1->VersionInfo.FileDescription->sr : node1->DescriptionText;
1236 sr2 = processItem2->VersionInfo.FileDescription ? processItem2->VersionInfo.FileDescription->sr : node2->DescriptionText;
1245 processItem1->VersionInfo.CompanyName,
1246 processItem2->VersionInfo.CompanyName,
1255 processItem1->VersionInfo.FileVersion,
1256 processItem2->VersionInfo.FileVersion,
1265 processItem1->FileName,
1266 processItem2->FileName,
1275 processItem1->CommandLine,
1276 processItem2->CommandLine,
1284 sortResult =
uintptrcmp(processItem1->VmCounters.PeakPagefileUsage, processItem2->VmCounters.PeakPagefileUsage);
1290 sortResult =
uintptrcmp(processItem1->VmCounters.WorkingSetSize, processItem2->VmCounters.WorkingSetSize);
1296 sortResult =
uintptrcmp(processItem1->VmCounters.PeakWorkingSetSize, processItem2->VmCounters.PeakWorkingSetSize);
1302 PhpUpdateProcessNodeWsCounters(node1);
1303 PhpUpdateProcessNodeWsCounters(node2);
1304 sortResult =
uintptrcmp(node1->WsCounters.NumberOfPrivatePages, node2->WsCounters.NumberOfPrivatePages);
1310 sortResult =
uintptrcmp(processItem1->WorkingSetPrivateSize, processItem2->WorkingSetPrivateSize);
1316 PhpUpdateProcessNodeWsCounters(node1);
1317 PhpUpdateProcessNodeWsCounters(node2);
1318 sortResult =
uintptrcmp(node1->WsCounters.NumberOfSharedPages, node2->WsCounters.NumberOfSharedPages);
1324 PhpUpdateProcessNodeWsCounters(node1);
1325 PhpUpdateProcessNodeWsCounters(node2);
1326 sortResult =
uintptrcmp(node1->WsCounters.NumberOfShareablePages, node2->WsCounters.NumberOfShareablePages);
1332 sortResult =
uintptrcmp(processItem1->VmCounters.VirtualSize, processItem2->VmCounters.VirtualSize);
1338 sortResult =
uintptrcmp(processItem1->VmCounters.PeakVirtualSize, processItem2->VmCounters.PeakVirtualSize);
1344 sortResult =
uintcmp(processItem1->VmCounters.PageFaultCount, processItem2->VmCounters.PageFaultCount);
1350 sortResult =
uintcmp(processItem1->SessionId, processItem2->SessionId);
1356 sortResult =
intcmp(processItem1->BasePriority, processItem2->BasePriority);
1362 sortResult =
uintcmp(processItem1->NumberOfThreads, processItem2->NumberOfThreads);
1368 sortResult =
uintcmp(processItem1->NumberOfHandles, processItem2->NumberOfHandles);
1374 sortResult =
uintcmp(node1->GdiHandles, node2->GdiHandles);
1380 sortResult =
uintcmp(node1->UserHandles, node2->UserHandles);
1387 processItem1->IoReadDelta.Delta + processItem1->IoOtherDelta.Delta,
1388 processItem2->IoReadDelta.Delta + processItem2->IoOtherDelta.Delta
1396 processItem1->IoWriteDelta.Delta,
1397 processItem2->IoWriteDelta.Delta
1404 sortResult =
uintcmp(processItem1->IntegrityLevel, processItem2->IntegrityLevel);
1410 sortResult =
uintcmp(node1->IoPriority, node2->IoPriority);
1416 sortResult =
uintcmp(node1->PagePriority, node2->PagePriority);
1422 sortResult =
int64cmp(processItem1->CreateTime.QuadPart, processItem2->CreateTime.QuadPart);
1429 processItem1->KernelTime.QuadPart + processItem1->UserTime.QuadPart,
1430 processItem2->KernelTime.QuadPart + processItem2->UserTime.QuadPart
1438 processItem1->KernelTime.QuadPart,
1439 processItem2->KernelTime.QuadPart
1447 processItem1->UserTime.QuadPart,
1448 processItem2->UserTime.QuadPart
1455 sortResult =
intcmp(processItem1->VerifyResult, processItem2->VerifyResult);
1462 processItem1->VerifySignerName,
1463 processItem2->VerifySignerName,
1471 PhpUpdateProcessNodeImage(node1);
1472 PhpUpdateProcessNodeImage(node2);
1474 node1->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE,
1475 node2->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
1482 sortResult = -
int64cmp(processItem1->CreateTime.QuadPart, processItem2->CreateTime.QuadPart);
1488 sortResult =
intcmp(processItem1->IsWow64Valid, processItem2->IsWow64Valid);
1490 if (sortResult == 0)
1491 sortResult =
intcmp(processItem1->IsWow64, processItem2->IsWow64);
1500 switch (processItem1->ElevationType)
1502 case TokenElevationTypeFull:
1505 case TokenElevationTypeLimited:
1513 switch (processItem2->ElevationType)
1515 case TokenElevationTypeFull:
1518 case TokenElevationTypeLimited:
1526 sortResult =
intcmp(key1, key2);
1532 PhpUpdateProcessNodeWindow(node1);
1533 PhpUpdateProcessNodeWindow(node2);
1540 PhpUpdateProcessNodeWindow(node1);
1541 PhpUpdateProcessNodeWindow(node2);
1542 sortResult =
intcmp(node1->WindowHung, node2->WindowHung);
1545 if (sortResult == 0)
1546 sortResult =
intcmp(!!node1->WindowHandle, !!node2->WindowHandle);
1552 sortResult =
uint64cmp(node1->CyclesDelta.Value, node2->CyclesDelta.Value);
1558 sortResult =
uint64cmp(processItem1->CycleTimeDelta.Value, processItem2->CycleTimeDelta.Value);
1564 sortResult =
uint64cmp(node1->CyclesDelta.Delta, node2->CyclesDelta.Delta);
1570 sortResult =
uint64cmp(processItem1->CycleTimeDelta.Delta, processItem2->CycleTimeDelta.Delta);
1576 PhpUpdateProcessNodeDepStatus(node1);
1577 PhpUpdateProcessNodeDepStatus(node2);
1578 sortResult =
uintcmp(node1->DepStatus, node2->DepStatus);
1584 PhpUpdateProcessNodeToken(node1);
1585 PhpUpdateProcessNodeToken(node2);
1586 sortResult =
intcmp(node1->VirtualizationEnabled, node2->VirtualizationEnabled);
1592 sortResult =
uintcmp(processItem1->ContextSwitchesDelta.Value, processItem2->ContextSwitchesDelta.Value);
1598 sortResult =
intcmp((
LONG)processItem1->ContextSwitchesDelta.Delta, (
LONG)processItem2->ContextSwitchesDelta.Delta);
1604 sortResult =
uintcmp(processItem1->PageFaultsDelta.Delta, processItem2->PageFaultsDelta.Delta);
1610 sortResult =
uint64cmp(processItem1->IoReadCountDelta.Value, processItem2->IoReadCountDelta.Value);
1616 sortResult =
uint64cmp(processItem1->IoWriteCountDelta.Value, processItem2->IoWriteCountDelta.Value);
1622 sortResult =
uint64cmp(processItem1->IoOtherCountDelta.Value, processItem2->IoOtherCountDelta.Value);
1628 sortResult =
uint64cmp(processItem1->IoReadDelta.Value, processItem2->IoReadDelta.Value);
1634 sortResult =
uint64cmp(processItem1->IoWriteDelta.Value, processItem2->IoWriteDelta.Value);
1640 sortResult =
uint64cmp(processItem1->IoOtherDelta.Value, processItem2->IoOtherDelta.Value);
1646 sortResult =
uint64cmp(processItem1->IoReadCountDelta.Delta, processItem2->IoReadCountDelta.Delta);
1652 sortResult =
uint64cmp(processItem1->IoWriteCountDelta.Delta, processItem2->IoWriteCountDelta.Delta);
1658 sortResult =
uint64cmp(processItem1->IoOtherCountDelta.Delta, processItem2->IoOtherCountDelta.Delta);
1664 PhpUpdateProcessOsContext(node1);
1665 PhpUpdateProcessOsContext(node2);
1666 sortResult =
uintcmp(node1->OsContextVersion, node2->OsContextVersion);
1672 sortResult =
uintptrcmp(processItem1->VmCounters.QuotaPagedPoolUsage, processItem2->VmCounters.QuotaPagedPoolUsage);
1678 sortResult =
uintptrcmp(processItem1->VmCounters.QuotaPeakPagedPoolUsage, processItem2->VmCounters.QuotaPeakPagedPoolUsage);
1684 sortResult =
uintptrcmp(processItem1->VmCounters.QuotaNonPagedPoolUsage, processItem2->VmCounters.QuotaNonPagedPoolUsage);
1690 sortResult =
uintptrcmp(processItem1->VmCounters.QuotaPeakNonPagedPoolUsage, processItem2->VmCounters.QuotaPeakNonPagedPoolUsage);
1696 PhpUpdateProcessNodeQuotaLimits(node1);
1697 PhpUpdateProcessNodeQuotaLimits(node2);
1698 sortResult =
uintptrcmp(node1->MinimumWorkingSetSize, node2->MinimumWorkingSetSize);
1704 PhpUpdateProcessNodeQuotaLimits(node1);
1705 PhpUpdateProcessNodeQuotaLimits(node2);
1706 sortResult =
uintptrcmp(node1->MaximumWorkingSetSize, node2->MaximumWorkingSetSize);
1712 sortResult =
intptrcmp(processItem1->PrivateBytesDelta.Delta, processItem2->PrivateBytesDelta.Delta);
1718 PhpUpdateProcessNodeImage(node1);
1719 PhpUpdateProcessNodeImage(node2);
1720 sortResult =
intcmp(node1->ImageSubsystem, node2->ImageSubsystem);
1732 PhpUpdateProcessNodeAppId(node1);
1733 PhpUpdateProcessNodeAppId(node2);
1740 PhpUpdateProcessNodeDpiAwareness(node1);
1741 PhpUpdateProcessNodeDpiAwareness(node2);
1742 sortResult =
uintcmp(node1->DpiAwareness, node2->DpiAwareness);
1748 PhpUpdateProcessNodeImage(node1);
1749 PhpUpdateProcessNodeImage(node2);
1751 node1->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_GUARD_CF,
1752 node2->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_GUARD_CF
1760 _In_opt_ PVOID Parameter1,
1761 _In_opt_ PVOID Parameter2,
1762 _In_opt_ PVOID Context
1795 static PVOID sortFunctions[] =
1875 int (__cdecl *sortFunction)(
const void *,
const void *);
1891 ProcessNodeList->
Count,
1892 ProcessTreeListSortColumn,
1893 ProcessTreeListSortOrder,
1898 sortFunction = sortFunctions[ProcessTreeListSortColumn];
1900 sortFunction = NULL;
1904 qsort(ProcessNodeList->
Items, ProcessNodeList->
Count,
sizeof(PVOID), sortFunction);
1934 switch (getCellText->
Id)
1948 cpuUsage = processItem->
CpuUsage * 100;
1952 cpuUsage = PhpCalculateInclusiveCpuUsage(node) * 100;
1955 if (cpuUsage >= 0.01)
1958 SIZE_T returnLength;
1965 getCellText->
Text.
Length = returnLength -
sizeof(WCHAR);
1971 SIZE_T returnLength;
1979 getCellText->
Text.
Length = returnLength -
sizeof(WCHAR);
2054 PhpUpdateProcessNodeWsCounters(node);
2060 PhpUpdateProcessNodeWsCounters(node);
2065 PhpUpdateProcessNodeWsCounters(node);
2098 PhpUpdateProcessNodeGdiUserHandles(node);
2102 PhpUpdateProcessNodeGdiUserHandles(node);
2162 PhpUpdateProcessNodeIoPagePriority(node);
2172 PhpUpdateProcessNodeIoPagePriority(node);
2183 SYSTEMTIME systemTime;
2215 PhpUpdateProcessNodeImage(node);
2231 LARGE_INTEGER currentTime;
2258 case TokenElevationTypeDefault:
2261 case TokenElevationTypeLimited:
2264 case TokenElevationTypeFull:
2281 PhpUpdateProcessNodeWindow(node);
2286 PhpUpdateProcessNodeWindow(node);
2321 PhpUpdateProcessNodeDepStatus(node);
2333 PhpUpdateProcessNodeToken(node);
2424 PhpUpdateProcessOsContext(node);
2469 PhpUpdateProcessNodeQuotaLimits(node);
2474 PhpUpdateProcessNodeQuotaLimits(node);
2500 format[1].
u.
Size = delta;
2508 PhpUpdateProcessNodeImage(node);
2514 case IMAGE_SUBSYSTEM_NATIVE:
2517 case IMAGE_SUBSYSTEM_WINDOWS_GUI:
2520 case IMAGE_SUBSYSTEM_WINDOWS_CUI:
2523 case IMAGE_SUBSYSTEM_OS2_CUI:
2526 case IMAGE_SUBSYSTEM_POSIX_CUI:
2538 PhpUpdateProcessNodeAppId(node);
2542 PhpUpdateProcessNodeDpiAwareness(node);
2560 PhpUpdateProcessNodeImage(node);
2591 getHighlightingColor.
Parameter = processItem;
2592 getHighlightingColor.
BackColor = RGB(0xff, 0xff, 0xff);
2598 if (getHighlightingColor.
Handled)
2603 if (getHighlightingColor.
Cache)
2674 if (getCellTooltip->
Column->
Id != 0)
2677 tickCount = GetTickCount();
2707 if (rect.right - rect.left <= 1)
2717 drawInfo.
Width = rect.right - rect.left - 1;
2718 drawInfo.
Height = rect.bottom - rect.top - 1;
2720 drawInfo.
BackColor = RGB(0x00, 0x00, 0x00);
2778 max = (FLOAT)processItem->
VmCounters.PeakPagefileUsage;
2823 (FLOAT)PhGetItemCircularBuffer_ULONG64(&processItem->
IoReadHistory, i) +
2824 (FLOAT)PhGetItemCircularBuffer_ULONG64(&processItem->
IoOtherHistory, i);
2826 (FLOAT)PhGetItemCircularBuffer_ULONG64(&processItem->
IoWriteHistory, i);
2828 if (max < data1 + data2)
2829 max = data1 + data2;
2867 PhpNeedGraphContext(customDraw->
Dc, drawInfo.
Width, drawInfo.
Height);
2896 for (i = 0; i < ProcessNodeList->
Count; i++)
2898 node = ProcessNodeList->
Items[i];
2912 TreeNew_GetSort(hwnd, &ProcessTreeListSortColumn, &ProcessTreeListSortOrder);
2924 if (GetKeyState(VK_CONTROL) < 0)
2928 if (GetKeyState(VK_CONTROL) < 0)
2932 if (GetKeyState(VK_SHIFT) >= 0)
2938 if (GetKeyState(VK_CONTROL) >= 0)
2998 for (i = 0; i < ProcessNodeList->
Count; i++)
3014 _Out_ PULONG NumberOfProcesses
3022 for (i = 0; i < ProcessNodeList->
Count; i++)
3033 *NumberOfProcesses = list->
Count;
3050 BOOLEAN needsRestructure =
FALSE;
3052 for (i = 0; i < ProcessNodeList->
Count; i++)
3059 needsRestructure =
TRUE;
3063 if (needsRestructure)
3073 for (i = 0; i < ProcessNodeList->
Count; i++)
3087 InvalidateRect(ProcessTreeListHandle, NULL,
FALSE);
3099 _In_ ULONG NumberOfProcessNodes
3105 BOOLEAN needsRestructure =
FALSE;
3109 for (i = 0; i < NumberOfProcessNodes; i++)
3111 if (ProcessNodes[i]->Node.Visible)
3113 leader = ProcessNodes[i];
3123 for (i = 0; i < NumberOfProcessNodes; i++)
3125 if (!ProcessNodes[i]->Node.Visible)
3128 node = ProcessNodes[i]->
Parent;
3133 needsRestructure =
TRUE;
3142 if (needsRestructure)
3152 _In_ HWND TreeListHandle,
3156 _Inout_ PULONG Index,
3157 _In_ PULONG DisplayToId,
3163 for (i = 0; i < Columns; i++)
3168 getCellText.
Node = &Node->Node;
3169 getCellText.
Id = DisplayToId[i];
3182 getCellText.
Text.
Length + Level * 2 *
sizeof(WCHAR)
3184 wmemset(text->
Buffer,
' ', Level * 2);
3188 Table[*Index][i] = text;
3194 for (i = 0; i < Node->Children->Count; i++)
3198 Node->Children->Items[i],
3209 _In_ HWND TreeListHandle,
3210 _In_ ULONG NumberOfNodes,
3224 PWSTR *displayToText;
3233 rows = NumberOfNodes + 1;
3241 for (i = 0; i < columns; i++)
3250 for (i = 0; i < RootNodes->Count; i++)
3254 RootNodes->Items[i],
3293 ProcessTreeListHandle,
3294 ProcessNodeList->
Count,
3295 ProcessNodeRootList,
3299 for (i = 0; i < lines->
Count; i++)
3303 line = lines->
Items[i];