29 static BOOLEAN DiskTreeNewCreated =
FALSE;
30 static HWND DiskTreeNewHandle;
31 static ULONG DiskTreeNewSortColumn;
41 static BOOLEAN DiskNeedsRedraw =
FALSE;
60 ToolStatusInterface = NULL;
64 tabPage.
Text = L
"Disk";
66 tabPage.
Index = MAXINT;
72 if (ToolStatusInterface)
121 DiskTreeNewCreated =
TRUE;
137 &DiskItemAddedRegistration
143 &DiskItemModifiedRegistration
149 &DiskItemRemovedRegistration
155 &DiskItemsUpdatedRegistration
158 SetCursor(LoadCursor(NULL, IDC_WAIT));
160 SetCursor(LoadCursor(NULL, IDC_ARROW));
166 _In_ PVOID Parameter1,
167 _In_ PVOID Parameter2,
168 _In_ PVOID Parameter3,
172 if ((BOOLEAN)Parameter1)
174 if (DiskTreeNewHandle)
175 SetFocus(DiskTreeNewHandle);
180 _In_ PVOID Parameter1,
181 _In_ PVOID Parameter2,
182 _In_ PVOID Parameter3,
187 ULONG mode = PtrToUlong(Parameter2);
196 _In_ PVOID Parameter1,
197 _In_ PVOID Parameter2,
198 _In_ PVOID Parameter3,
202 if (DiskTreeNewHandle)
203 SendMessage(DiskTreeNewHandle, WM_SETFONT, (WPARAM)Parameter1,
TRUE);
228 DiskTreeNewHandle = hwnd;
230 SendMessage(
TreeNew_GetTooltips(DiskTreeNewHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, 0x7fff);
253 if (ToolStatusInterface)
284 if (!DiskTreeNewCreated)
292 sortSettings.
X = sortColumn;
293 sortSettings.
Y = sortOrder;
357 if ((index = PhFindItemList(DiskNodeList, DiskNode)) != -1)
384 #define SORT_FUNCTION(Column) EtpDiskTreeNewCompare##Column
386 #define BEGIN_SORT_FUNCTION(Column) static int __cdecl EtpDiskTreeNewCompare##Column( \
387 _In_ const void *_elem1, \
388 _In_ const void *_elem2 \
391 PET_DISK_NODE node1 = *(PET_DISK_NODE *)_elem1; \
392 PET_DISK_NODE node2 = *(PET_DISK_NODE *)_elem2; \
393 PET_DISK_ITEM diskItem1 = node1->DiskItem; \
394 PET_DISK_ITEM diskItem2 = node2->DiskItem; \
397 #define END_SORT_FUNCTION \
398 if (sortResult == 0) \
399 sortResult = PhCompareString(diskItem1->FileNameWin32, diskItem2->FileNameWin32, TRUE); \
401 return PhModifySort(sortResult, DiskTreeNewSortOrder); \
418 sortResult =
uint64cmp(diskItem1->ReadAverage, diskItem2->ReadAverage);
424 sortResult =
uint64cmp(diskItem1->WriteAverage, diskItem2->WriteAverage);
430 sortResult =
uint64cmp(diskItem1->ReadAverage + diskItem1->WriteAverage, diskItem2->ReadAverage + diskItem2->WriteAverage);
436 sortResult =
uintcmp(diskItem1->IoPriority, diskItem2->IoPriority);
442 sortResult =
singlecmp(diskItem1->ResponseTimeAverage, diskItem2->ResponseTimeAverage);
449 _In_opt_ PVOID Parameter1,
450 _In_opt_ PVOID Parameter2,
451 _In_opt_ PVOID Context
462 if (!getChildren->
Node)
464 static PVOID sortFunctions[] =
474 int (__cdecl *sortFunction)(
const void *,
const void *);
477 sortFunction = sortFunctions[DiskTreeNewSortColumn];
483 qsort(DiskNodeList->
Items, DiskNodeList->
Count,
sizeof(PVOID), sortFunction);
506 switch (getCellText->
Id)
587 if (getCellTooltip->
Column->
Id != 0)
595 PVOID callbackContext;
603 fakeGetCellTooltip.
Flags = 0;
604 fakeGetCellTooltip.
Node = &processNode->
Node;
605 fakeGetCellTooltip.
Column = fixedColumn;
608 fakeGetCellTooltip.
Font = getCellTooltip->
Font;
645 if (GetKeyState(VK_CONTROL) < 0)
649 if (GetKeyState(VK_CONTROL) < 0)
702 if (!DiskItem->ProcessId)
706 PhInitFormatU(&format[2], HandleToUlong(DiskItem->ProcessId));
709 if (DiskItem->ProcessName)
724 for (i = 0; i < DiskNodeList->
Count; i++)
740 _Out_ PULONG NumberOfDiskItems
748 for (i = 0; i < DiskNodeList->
Count; i++)
759 *NumberOfDiskItems = list->
Count;
777 if (!DiskNode->Node.Visible)
807 for (i = 0; i < lines->
Count; i++)
811 line = lines->
Items[i];
889 _In_ ULONG NumberOfDiskItems
894 if (NumberOfDiskItems == 0)
898 else if (NumberOfDiskItems == 1)
904 if (DiskItems[0]->ProcessRecord)
914 item->
Text = L
"Process Properties";
932 ULONG numberOfDiskItems;
936 if (numberOfDiskItems != 0)
968 _In_opt_ PVOID Parameter,
969 _In_opt_ PVOID Context
979 _In_opt_ PVOID Parameter,
980 _In_opt_ PVOID Context
987 _In_opt_ PVOID Parameter,
988 _In_opt_ PVOID Context
995 _In_opt_ PVOID Parameter,
996 _In_opt_ PVOID Context
1003 _In_ PVOID Parameter
1009 if (!DiskNeedsRedraw)
1012 DiskNeedsRedraw =
TRUE;
1020 _In_ PVOID Parameter
1029 _In_ PVOID Parameter
1034 if (!DiskNeedsRedraw)
1037 DiskNeedsRedraw =
TRUE;
1044 _In_ PVOID Parameter
1049 if (DiskNeedsRedraw)
1052 DiskNeedsRedraw =
FALSE;
1057 for (i = 0; i < DiskNodeList->
Count; i++)
1067 InvalidateRect(DiskTreeNewHandle, NULL,
FALSE);
1071 _In_opt_ PVOID Parameter,
1072 _In_opt_ PVOID Context
1083 _In_opt_ PVOID Context
1105 SetFocus(DiskTreeNewHandle);
1118 return DiskTreeNewHandle;
1134 SendMessage(GetDlgItem(hwndDlg,
IDC_RESTART), BCM_SETSHIELD, 0,
TRUE);
1138 SetDlgItemText(hwndDlg,
IDC_ERROR, L
"Unable to start the kernel event tracing session.");
1139 ShowWindow(GetDlgItem(hwndDlg,
IDC_RESTART), SW_HIDE);
1145 switch (LOWORD(wParam))
1152 L
"-v -selecttab Disk",
1171 case WM_CTLCOLORBTN:
1172 case WM_CTLCOLORSTATIC:
1174 SetBkMode((HDC)wParam, TRANSPARENT);
1175 return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);