53 _In_opt_ PVOID Parameter1,
54 _In_opt_ PVOID Parameter2,
55 _In_opt_ PVOID Context
66 static HWND NetworkTreeListHandle;
67 static ULONG NetworkTreeListSortColumn;
73 static LONG NextUniqueId = 1;
115 NetworkTreeListHandle = hwnd;
117 SendMessage(
TreeNew_GetTooltips(NetworkTreeListHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT);
145 treeNewInfo.
CmData = &NetworkTreeListCm;
173 settings =
PhCmSaveSettingsEx(NetworkTreeListHandle, &NetworkTreeListCm, 0, &sortSettings);
184 return &FilterSupport;
203 &NetworkNodeStateList,
212 networkNode->
UniqueId = NextUniqueId++;
245 NetworkNodeHashtable,
246 &lookupNetworkNodePtr
266 &NetworkNode->ShState,
267 &NetworkNodeStateList,
270 NetworkTreeListHandle
289 if ((index = PhFindItemList(NetworkNodeList, NetworkNode)) != -1)
329 #define SORT_FUNCTION(Column) PhpNetworkTreeNewCompare##Column
331 #define BEGIN_SORT_FUNCTION(Column) static int __cdecl PhpNetworkTreeNewCompare##Column( \
332 _In_ const void *_elem1, \
333 _In_ const void *_elem2 \
336 PPH_NETWORK_NODE node1 = *(PPH_NETWORK_NODE *)_elem1; \
337 PPH_NETWORK_NODE node2 = *(PPH_NETWORK_NODE *)_elem2; \
338 PPH_NETWORK_ITEM networkItem1 = node1->NetworkItem; \
339 PPH_NETWORK_ITEM networkItem2 = node2->NetworkItem; \
342 #define END_SORT_FUNCTION \
343 if (sortResult == 0) \
344 sortResult = intcmp(node1->UniqueId, node2->UniqueId); \
346 return PhModifySort(sortResult, NetworkTreeListSortOrder); \
376 sortResult =
uintcmp(networkItem1->LocalEndpoint.Port, networkItem2->LocalEndpoint.Port);
388 sortResult =
uintcmp(networkItem1->RemoteEndpoint.Port, networkItem2->RemoteEndpoint.Port);
394 sortResult =
uintcmp(networkItem1->ProtocolType, networkItem2->ProtocolType);
400 sortResult =
uintcmp(networkItem1->State, networkItem2->State);
412 sortResult =
uint64cmp(networkItem1->CreateTime.QuadPart, networkItem2->CreateTime.QuadPart);
419 _In_opt_ PVOID Parameter1,
420 _In_opt_ PVOID Parameter2,
421 _In_opt_ PVOID Context
435 if (!getChildren->
Node)
437 static PVOID sortFunctions[] =
449 int (__cdecl *sortFunction)(
const void *,
const void *);
453 NetworkNodeList->
Count,
454 NetworkTreeListSortColumn,
455 NetworkTreeListSortOrder,
460 sortFunction = sortFunctions[NetworkTreeListSortColumn];
466 qsort(NetworkNodeList->
Items, NetworkNodeList->
Count,
sizeof(PVOID), sortFunction);
490 switch (getCellText->
Id)
524 SYSTEMTIME systemTime;
572 if (getCellTooltip->
Column->
Id != 0)
598 TreeNew_GetSort(hwnd, &NetworkTreeListSortColumn, &NetworkTreeListSortOrder);
610 if (GetKeyState(VK_CONTROL) < 0)
614 if (GetKeyState(VK_CONTROL) < 0)
662 if (!NetworkItem->ProcessId)
669 if (NetworkItem->ProcessName)
681 if (NetworkNode->NetworkItem->LocalHostString)
682 NetworkNode->LocalAddressText = NetworkNode->NetworkItem->LocalHostString->sr;
686 if (NetworkNode->NetworkItem->RemoteHostString)
687 NetworkNode->RemoteAddressText = NetworkNode->NetworkItem->RemoteHostString->sr;
699 for (i = 0; i < NetworkNodeList->
Count; i++)
715 _Out_ PULONG NumberOfNetworkItems
723 for (i = 0; i < NetworkNodeList->
Count; i++)
734 *NumberOfNetworkItems = list->
Count;
752 if (!NetworkNode->Node.Visible)
757 TreeNew_SelectRange(NetworkTreeListHandle, NetworkNode->Node.Index, NetworkNode->Node.Index);
782 for (i = 0; i < lines->
Count; i++)
786 line = lines->
Items[i];