28 typedef struct _PH_CM_SORT_CONTEXT
44 Manager->Handle = Handle;
45 Manager->MinId = MinId;
46 Manager->NextId = MinId;
47 Manager->PostSortFunction = PostSortFunction;
49 Manager->NotifyList = NULL;
56 PLIST_ENTRY listEntry;
59 listEntry = Manager->ColumnListHead.Flink;
61 while (listEntry != &Manager->ColumnListHead)
63 column = CONTAINING_RECORD(listEntry,
PH_CM_COLUMN, ListEntry);
64 listEntry = listEntry->Flink;
69 if (Manager->NotifyList)
78 _In_opt_ PVOID Context,
79 _In_ PVOID SortFunction
87 column->
Id = Manager->NextId++;
89 column->
SubId = SubId;
95 tnColumn.
Id = column->
Id;
97 tnColumn.
Visible = Column->Visible;
100 tnColumn.
Text = Column->Text;
101 tnColumn.
Width = Column->Width;
103 tnColumn.
DisplayIndex = Column->Visible ? Column->DisplayIndex : -1;
116 PLIST_ENTRY listEntry;
119 listEntry = Manager->ColumnListHead.Flink;
121 while (listEntry != &Manager->ColumnListHead)
123 column = CONTAINING_RECORD(listEntry,
PH_CM_COLUMN, ListEntry);
128 listEntry = listEntry->Flink;
139 if (!Manager->NotifyList)
145 if (PhFindItemList(Manager->NotifyList, Plugin) != -1)
155 _In_opt_ PVOID Parameter1,
156 _In_opt_ PVOID Parameter2,
174 if (getCellText->
Id < Manager->MinId)
191 if (customDraw->
Column->
Id < Manager->MinId)
205 if (tlColumn->
Id < Manager->MinId)
217 if (Manager->NotifyList)
221 for (i = 0; i < Manager->NotifyList->Count; i++)
223 plugin = Manager->NotifyList->Items[i];
226 pluginMessage.
Message = Message;
229 pluginMessage.
SubId = 0;
240 pluginMessage.
Message = Message;
249 static int __cdecl PhCmpSortFunction(
251 _In_
const void *elem1,
252 _In_
const void *elem2
256 PVOID node1 = *(PVOID *)elem1;
257 PVOID node2 = *(PVOID *)elem2;
260 result = sortContext->SortFunction(node1, node2, sortContext->SubId, sortContext->Context);
262 return sortContext->PostSortFunction(result, node1, node2, sortContext->SortOrder);
267 _In_ ULONG NumberOfNodes,
268 _In_ ULONG SortColumn,
277 if (SortColumn < Manager->MinId)
289 sortContext.SubId = column->
SubId;
290 sortContext.Context = column->
Context;
291 sortContext.PostSortFunction = Manager->PostSortFunction;
292 sortContext.SortOrder = SortOrder;
293 qsort_s(Nodes, NumberOfNodes,
sizeof(PVOID), PhCmpSortFunction, &sortContext);
299 _In_ HWND TreeNewHandle,
307 _In_ HWND TreeNewHandle,
314 BOOLEAN result =
FALSE;
321 BOOLEAN hasFixedColumn;
330 if (Settings->Length != 0)
334 remainingColumnPart = *Settings;
336 while (remainingColumnPart.
Length != 0)
345 if (columnPart.
Length != 0)
351 if (valuePart.
Length == 0)
354 if (valuePart.
Buffer[0] ==
'+')
391 displayIndex = (ULONG)integer;
395 if (valuePart.
Length != 0)
406 width = (ULONG)integer;
411 column->
Width = width;
424 memset(orderArray, 0,
sizeof(orderArray));
427 while (count < total)
441 setColumn.
Width = (*columnPtr)->Width;
444 if (!setColumn.
Fixed)
448 if (hasFixedColumn && (*columnPtr)->DisplayIndex != 0)
449 (*columnPtr)->DisplayIndex--;
453 orderArray[(*columnPtr)->DisplayIndex] = i;
455 if ((ULONG)maxOrder < (*columnPtr)->DisplayIndex + 1)
456 maxOrder = (*columnPtr)->DisplayIndex + 1;
460 else if (!setColumn.
Fixed)
470 setColumn.
Width = (*columnPtr)->Width;
502 if (SortSettings && SortSettings->Length != 0)
513 if (valuePart.
Buffer[0] ==
'+')
525 sortColumn = cmColumn->
Id;
531 sortColumn = (ULONG)integer;
548 _In_ HWND TreeNewHandle
555 _In_ HWND TreeNewHandle,
577 while (count < total)
585 if (!Manager || i < Manager->MinId)
613 if (!Manager || i < Manager->MinId)
655 if (!Manager || sortColumn < Manager->MinId)