Process Hacker
treenew.h
Go to the documentation of this file.
1 #ifndef _PH_TREENEW_H
2 #define _PH_TREENEW_H
3 
4 #define PH_TREENEW_CLASSNAME L"PhTreeNew"
5 
6 #define PH_TREENEW_SEARCH_TIMEOUT 1000
7 #define PH_TREENEW_SEARCH_MAXIMUM_LENGTH 1023
8 
9 typedef struct _PH_TREENEW_COLUMN
10 {
11  union
12  {
13  ULONG Flags;
14  struct
15  {
16  ULONG Visible : 1;
17  ULONG CustomDraw : 1;
18  ULONG Fixed : 1; // whether this is the fixed column
19  ULONG SortDescending : 1; // sort descending on initial click rather than ascending
20  ULONG SpareFlags : 28;
21  };
22  };
23  ULONG Id;
24  PVOID Context;
25  PWSTR Text;
27  ULONG Alignment;
28  ULONG DisplayIndex; // -1 for fixed column or invalid
29 
30  ULONG TextFlags;
31 
32  struct
33  {
34  LONG ViewIndex; // actual index in header control
35  LONG ViewX; // 0 for the fixed column, and an offset from the divider for normal columns
36  } s;
38 
39 typedef struct _PH_TREENEW_NODE
40 {
41  union
42  {
43  ULONG Flags;
44  struct
45  {
46  ULONG Visible : 1;
47  ULONG Selected : 1;
48  ULONG Expanded : 1;
49  ULONG UseAutoForeColor : 1;
50  ULONG UseTempBackColor : 1;
51  ULONG Unselectable : 1;
52  ULONG SpareFlags : 26;
53  };
54  };
55 
56  COLORREF BackColor;
57  COLORREF ForeColor;
58  COLORREF TempBackColor;
59  HFONT Font;
60  HICON Icon;
61 
64 
65  ULONG Index; // index within the flat list
66  ULONG Level; // 0 for root, 1, 2, ...
67 
68  struct
69  {
70  union
71  {
72  ULONG Flags2;
73  struct
74  {
75  ULONG IsLeaf : 1;
76  ULONG CachedColorValid : 1;
77  ULONG CachedFontValid : 1;
78  ULONG CachedIconValid : 1;
79  ULONG PlusMinusHot : 1;
80  ULONG SpareFlags2 : 27;
81  };
82  };
83 
84  // Temp. drawing data
85  COLORREF DrawBackColor;
86  COLORREF DrawForeColor;
87  } s;
89 
90 // Styles
91 #define TN_STYLE_ICONS 0x1
92 #define TN_STYLE_DOUBLE_BUFFERED 0x2
93 #define TN_STYLE_NO_DIVIDER 0x4
94 #define TN_STYLE_ANIMATE_DIVIDER 0x8
95 #define TN_STYLE_NO_COLUMN_SORT 0x10
96 #define TN_STYLE_NO_COLUMN_REORDER 0x20
97 #define TN_STYLE_THIN_ROWS 0x40
98 #define TN_STYLE_NO_COLUMN_HEADER 0x80
99 
100 // Extended flags
101 #define TN_FLAG_ITEM_DRAG_SELECT 0x1
102 #define TN_FLAG_NO_UNFOLDING_TOOLTIPS 0x2
103 
104 // Callback flags
105 #define TN_CACHE 0x1
106 #define TN_AUTO_FORECOLOR 0x1000
107 
108 // Column change flags
109 #define TN_COLUMN_CONTEXT 0x1
110 #define TN_COLUMN_TEXT 0x2
111 #define TN_COLUMN_WIDTH 0x4
112 #define TN_COLUMN_ALIGNMENT 0x8
113 #define TN_COLUMN_DISPLAYINDEX 0x10
114 #define TN_COLUMN_TEXTFLAGS 0x20
115 #define TN_COLUMN_FLAG_VISIBLE 0x100000
116 #define TN_COLUMN_FLAG_CUSTOMDRAW 0x200000
117 #define TN_COLUMN_FLAG_FIXED 0x400000
118 #define TN_COLUMN_FLAG_SORTDESCENDING 0x800000
119 #define TN_COLUMN_FLAGS 0xfff00000
120 
121 // Cache flags
122 #define TN_CACHE_COLOR 0x1
123 #define TN_CACHE_FONT 0x2
124 #define TN_CACHE_ICON 0x4
125 
126 // Cell part input flags
127 #define TN_MEASURE_TEXT 0x1
128 
129 // Cell part flags
130 #define TN_PART_CELL 0x1
131 #define TN_PART_PLUSMINUS 0x2
132 #define TN_PART_ICON 0x4
133 #define TN_PART_CONTENT 0x8
134 #define TN_PART_TEXT 0x10
135 
136 // Hit test input flags
137 #define TN_TEST_COLUMN 0x1
138 #define TN_TEST_SUBITEM 0x2 // requires TN_TEST_COLUMN
139 
140 // Hit test flags
141 #define TN_HIT_LEFT 0x1
142 #define TN_HIT_RIGHT 0x2
143 #define TN_HIT_ABOVE 0x4
144 #define TN_HIT_BELOW 0x8
145 #define TN_HIT_ITEM 0x10
146 #define TN_HIT_ITEM_PLUSMINUS 0x20 // requires TN_TEST_SUBITEM
147 #define TN_HIT_ITEM_ICON 0x40 // requires TN_TEST_SUBITEM
148 #define TN_HIT_ITEM_CONTENT 0x80 // requires TN_TEST_SUBITEM
149 #define TN_HIT_DIVIDER 0x100
150 
151 // Selection flags
152 #define TN_SELECT_DESELECT 0x1
153 #define TN_SELECT_TOGGLE 0x2
154 #define TN_SELECT_RESET 0x4
155 
156 // Auto-size flags
157 #define TN_AUTOSIZE_REMAINING_SPACE 0x1
158 
160 {
161  ULONG Flags;
162  RECT RowRect;
163  RECT CellRect; // TN_PART_CELL
164  RECT PlusMinusRect; // TN_PART_PLUSMINUS
165  RECT IconRect; // TN_PART_ICON
166  RECT ContentRect; // TN_PART_CONTENT
167  RECT TextRect; // TN_PART_TEXT
168  PH_STRINGREF Text; // TN_PART_TEXT
169  HFONT Font; // TN_PART_TEXT
171 
172 typedef struct _PH_TREENEW_HIT_TEST
173 {
174  POINT Point;
175  ULONG InFlags;
176 
177  ULONG Flags;
178  PPH_TREENEW_NODE Node;
179  PPH_TREENEW_COLUMN Column; // requires TN_TEST_COLUMN
181 
183 {
184  TreeNewGetChildren, // PPH_TREENEW_GET_CHILDREN Parameter1
185  TreeNewIsLeaf, // PPH_TREENEW_IS_LEAF Parameter1
186  TreeNewGetCellText, // PPH_TREENEW_GET_CELL_TEXT Parameter1
187  TreeNewGetNodeColor, // PPH_TREENEW_GET_NODE_COLOR Parameter1
188  TreeNewGetNodeFont, // PPH_TREENEW_GET_NODE_FONT Parameter1
189  TreeNewGetNodeIcon, // PPH_TREENEW_GET_NODE_ICON Parameter1
190  TreeNewGetCellTooltip, // PPH_TREENEW_GET_CELL_TOOLTIP Parameter1
191  TreeNewCustomDraw, // PPH_TREENEW_CUSTOM_DRAW Parameter1
192 
193  // Notifications
194  TreeNewNodeExpanding, // PPH_TREENEW_NODE Parameter1, PPH_TREENEW_NODE_EVENT Parameter2
195  TreeNewNodeSelecting, // PPH_TREENEW_NODE Parameter1
196 
199 
200  TreeNewKeyDown, // PPH_TREENEW_KEY_EVENT Parameter1
201  TreeNewLeftClick, // PPH_TREENEW_MOUSE_EVENT Parameter1
202  TreeNewRightClick, // PPH_TREENEW_MOUSE_EVENT Parameter1
203  TreeNewLeftDoubleClick, // PPH_TREENEW_MOUSE_EVENT Parameter1
204  TreeNewRightDoubleClick, // PPH_TREENEW_MOUSE_EVENT Parameter1
205  TreeNewContextMenu, // PPH_TREENEW_CONTEXT_MENU Parameter1
206 
207  TreeNewHeaderRightClick, // PPH_TREENEW_HEADER_MOUSE_EVENT Parameter1
208  TreeNewIncrementalSearch, // PPH_TREENEW_SEARCH_EVENT Parameter1
209 
210  TreeNewColumnResized, // PPH_TREENEW_COLUMN Parameter1
212 
214  TreeNewGetDialogCode, // ULONG Parameter1, PULONG Parameter2
215 
218 
219 typedef BOOLEAN (NTAPI *PPH_TREENEW_CALLBACK)(
220  _In_ HWND hwnd,
221  _In_ PH_TREENEW_MESSAGE Message,
222  _In_opt_ PVOID Parameter1,
223  _In_opt_ PVOID Parameter2,
224  _In_opt_ PVOID Context
225  );
226 
228 {
229  ULONG Flags;
230  PPH_TREENEW_NODE Node;
231 
233  PPH_TREENEW_NODE *Children; // can be NULL if no children
235 
236 typedef struct _PH_TREENEW_IS_LEAF
237 {
238  ULONG Flags;
239  PPH_TREENEW_NODE Node;
240 
241  BOOLEAN IsLeaf;
243 
245 {
246  ULONG Flags;
247  PPH_TREENEW_NODE Node;
248  ULONG Id;
249 
252 
254 {
255  ULONG Flags;
256  PPH_TREENEW_NODE Node;
257 
258  COLORREF BackColor;
259  COLORREF ForeColor;
261 
263 {
264  ULONG Flags;
265  PPH_TREENEW_NODE Node;
266 
267  HFONT Font;
269 
271 {
272  ULONG Flags;
273  PPH_TREENEW_NODE Node;
274 
275  HICON Icon;
277 
279 {
280  ULONG Flags;
281  PPH_TREENEW_NODE Node;
282  PPH_TREENEW_COLUMN Column;
283 
284  BOOLEAN Unfolding;
286  HFONT Font;
289 
291 {
292  PPH_TREENEW_NODE Node;
293  PPH_TREENEW_COLUMN Column;
294 
295  HDC Dc;
296  RECT CellRect;
297  RECT TextRect;
299 
301 {
302  POINT Location;
303  PPH_TREENEW_NODE Node;
304  PPH_TREENEW_COLUMN Column;
305  ULONG KeyFlags;
307 
308 typedef struct _PH_TREENEW_KEY_EVENT
309 {
310  BOOLEAN Handled;
311  ULONG VirtualKey;
312  ULONG Data;
314 
316 {
317  BOOLEAN Handled;
318  ULONG Flags;
319  PVOID Reserved1;
320  PVOID Reserved2;
322 
324 {
325  POINT Location;
327  PPH_TREENEW_NODE Node;
328  PPH_TREENEW_COLUMN Column;
331 
333 {
335  POINT Location;
337  PPH_TREENEW_COLUMN Column;
339 
341 {
346 
347 #define TNM_FIRST (WM_USER + 1)
348 #define TNM_SETCALLBACK (WM_USER + 1)
349 #define TNM_NODESADDED (WM_USER + 2) // unimplemented
350 #define TNM_NODESREMOVED (WM_USER + 3) // unimplemented
351 #define TNM_NODESSTRUCTURED (WM_USER + 4)
352 #define TNM_ADDCOLUMN (WM_USER + 5)
353 #define TNM_REMOVECOLUMN (WM_USER + 6)
354 #define TNM_GETCOLUMN (WM_USER + 7)
355 #define TNM_SETCOLUMN (WM_USER + 8)
356 #define TNM_GETCOLUMNORDERARRAY (WM_USER + 9)
357 #define TNM_SETCOLUMNORDERARRAY (WM_USER + 10)
358 #define TNM_SETCURSOR (WM_USER + 11)
359 #define TNM_GETSORT (WM_USER + 12)
360 #define TNM_SETSORT (WM_USER + 13)
361 #define TNM_SETTRISTATE (WM_USER + 14)
362 #define TNM_ENSUREVISIBLE (WM_USER + 15)
363 #define TNM_SCROLL (WM_USER + 16)
364 #define TNM_GETFLATNODECOUNT (WM_USER + 17)
365 #define TNM_GETFLATNODE (WM_USER + 18)
366 #define TNM_GETCELLTEXT (WM_USER + 19)
367 #define TNM_SETNODEEXPANDED (WM_USER + 20)
368 #define TNM_GETMAXID (WM_USER + 21)
369 #define TNM_SETMAXID (WM_USER + 22)
370 #define TNM_INVALIDATENODE (WM_USER + 23)
371 #define TNM_INVALIDATENODES (WM_USER + 24)
372 #define TNM_GETFIXEDHEADER (WM_USER + 25)
373 #define TNM_GETHEADER (WM_USER + 26)
374 #define TNM_GETTOOLTIPS (WM_USER + 27)
375 #define TNM_SELECTRANGE (WM_USER + 28)
376 #define TNM_DESELECTRANGE (WM_USER + 29)
377 #define TNM_GETCOLUMNCOUNT (WM_USER + 30)
378 #define TNM_SETREDRAW (WM_USER + 31)
379 #define TNM_GETVIEWPARTS (WM_USER + 32)
380 #define TNM_GETFIXEDCOLUMN (WM_USER + 33)
381 #define TNM_GETFIRSTCOLUMN (WM_USER + 34)
382 #define TNM_SETFOCUSNODE (WM_USER + 35)
383 #define TNM_SETMARKNODE (WM_USER + 36)
384 #define TNM_SETHOTNODE (WM_USER + 37)
385 #define TNM_SETEXTENDEDFLAGS (WM_USER + 38)
386 #define TNM_GETCALLBACK (WM_USER + 39)
387 #define TNM_HITTEST (WM_USER + 40)
388 #define TNM_GETVISIBLECOLUMNCOUNT (WM_USER + 41)
389 #define TNM_AUTOSIZECOLUMN (WM_USER + 42)
390 #define TNM_SETEMPTYTEXT (WM_USER + 43)
391 #define TNM_SETROWHEIGHT (WM_USER + 44)
392 #define TNM_LAST (WM_USER + 44)
393 
394 #define TreeNew_SetCallback(hWnd, Callback, Context) \
395  SendMessage((hWnd), TNM_SETCALLBACK, (WPARAM)(Context), (LPARAM)(Callback))
396 
397 #define TreeNew_NodesStructured(hWnd) \
398  SendMessage((hWnd), TNM_NODESSTRUCTURED, 0, 0)
399 
400 #define TreeNew_AddColumn(hWnd, Column) \
401  SendMessage((hWnd), TNM_ADDCOLUMN, 0, (LPARAM)(Column))
402 
403 #define TreeNew_RemoveColumn(hWnd, Id) \
404  SendMessage((hWnd), TNM_REMOVECOLUMN, (WPARAM)(Id), 0)
405 
406 #define TreeNew_GetColumn(hWnd, Id, Column) \
407  SendMessage((hWnd), TNM_GETCOLUMN, (WPARAM)(Id), (LPARAM)(Column))
408 
409 #define TreeNew_SetColumn(hWnd, Mask, Column) \
410  SendMessage((hWnd), TNM_SETCOLUMN, (WPARAM)(Mask), (LPARAM)(Column))
411 
412 #define TreeNew_GetColumnOrderArray(hWnd, Count, Array) \
413  SendMessage((hWnd), TNM_GETCOLUMNORDERARRAY, (WPARAM)(Count), (LPARAM)(Array))
414 
415 #define TreeNew_SetColumnOrderArray(hWnd, Count, Array) \
416  SendMessage((hWnd), TNM_SETCOLUMNORDERARRAY, (WPARAM)(Count), (LPARAM)(Array))
417 
418 #define TreeNew_SetCursor(hWnd, Cursor) \
419  SendMessage((hWnd), TNM_SETCURSOR, 0, (LPARAM)(Cursor))
420 
421 #define TreeNew_GetSort(hWnd, Column, Order) \
422  SendMessage((hWnd), TNM_GETSORT, (WPARAM)(Column), (LPARAM)(Order))
423 
424 #define TreeNew_SetSort(hWnd, Column, Order) \
425  SendMessage((hWnd), TNM_SETSORT, (WPARAM)(Column), (LPARAM)(Order))
426 
427 #define TreeNew_SetTriState(hWnd, TriState) \
428  SendMessage((hWnd), TNM_SETTRISTATE, (WPARAM)(TriState), 0)
429 
430 #define TreeNew_EnsureVisible(hWnd, Node) \
431  SendMessage((hWnd), TNM_ENSUREVISIBLE, 0, (LPARAM)(Node))
432 
433 #define TreeNew_Scroll(hWnd, DeltaRows, DeltaX) \
434  SendMessage((hWnd), TNM_SCROLL, (WPARAM)(DeltaRows), (LPARAM)(DeltaX))
435 
436 #define TreeNew_GetFlatNodeCount(hWnd) \
437  ((ULONG)SendMessage((hWnd), TNM_GETFLATNODECOUNT, 0, 0))
438 
439 #define TreeNew_GetFlatNode(hWnd, Index) \
440  ((PPH_TREENEW_NODE)SendMessage((hWnd), TNM_GETFLATNODE, (WPARAM)(Index), 0))
441 
442 #define TreeNew_GetCellText(hWnd, GetCellText) \
443  SendMessage((hWnd), TNM_GETCELLTEXT, 0, (LPARAM)(GetCellText))
444 
445 #define TreeNew_SetNodeExpanded(hWnd, Node, Expanded) \
446  SendMessage((hWnd), TNM_SETNODEEXPANDED, (WPARAM)(Expanded), (LPARAM)(Node))
447 
448 #define TreeNew_GetMaxId(hWnd) \
449  ((ULONG)SendMessage((hWnd), TNM_GETMAXID, 0, 0))
450 
451 #define TreeNew_SetMaxId(hWnd, MaxId) \
452  SendMessage((hWnd), TNM_SETMAXID, (WPARAM)(MaxId), 0)
453 
454 #define TreeNew_InvalidateNode(hWnd, Node) \
455  SendMessage((hWnd), TNM_INVALIDATENODE, 0, (LPARAM)(Node))
456 
457 #define TreeNew_InvalidateNodes(hWnd, Start, End) \
458  SendMessage((hWnd), TNM_INVALIDATENODES, (WPARAM)(Start), (LPARAM)(End))
459 
460 #define TreeNew_GetFixedHeader(hWnd) \
461  ((HWND)SendMessage((hWnd), TNM_GETFIXEDHEADER, 0, 0))
462 
463 #define TreeNew_GetHeader(hWnd) \
464  ((HWND)SendMessage((hWnd), TNM_GETHEADER, 0, 0))
465 
466 #define TreeNew_GetTooltips(hWnd) \
467  ((HWND)SendMessage((hWnd), TNM_GETTOOLTIPS, 0, 0))
468 
469 #define TreeNew_SelectRange(hWnd, Start, End) \
470  SendMessage((hWnd), TNM_SELECTRANGE, (WPARAM)(Start), (LPARAM)(End))
471 
472 #define TreeNew_DeselectRange(hWnd, Start, End) \
473  SendMessage((hWnd), TNM_DESELECTRANGE, (WPARAM)(Start), (LPARAM)(End))
474 
475 #define TreeNew_GetColumnCount(hWnd) \
476  ((ULONG)SendMessage((hWnd), TNM_GETCOLUMNCOUNT, 0, 0))
477 
478 #define TreeNew_SetRedraw(hWnd, Redraw) \
479  ((LONG)SendMessage((hWnd), TNM_SETREDRAW, (WPARAM)(Redraw), 0))
480 
481 #define TreeNew_GetViewParts(hWnd, Parts) \
482  SendMessage((hWnd), TNM_GETVIEWPARTS, 0, (LPARAM)(Parts))
483 
484 #define TreeNew_GetFixedColumn(hWnd) \
485  ((PPH_TREENEW_COLUMN)SendMessage((hWnd), TNM_GETFIXEDCOLUMN, 0, 0))
486 
487 #define TreeNew_GetFirstColumn(hWnd) \
488  ((PPH_TREENEW_COLUMN)SendMessage((hWnd), TNM_GETFIRSTCOLUMN, 0, 0))
489 
490 #define TreeNew_SetFocusNode(hWnd, Node) \
491  SendMessage((hWnd), TNM_SETFOCUSNODE, 0, (LPARAM)(Node))
492 
493 #define TreeNew_SetMarkNode(hWnd, Node) \
494  SendMessage((hWnd), TNM_SETMARKNODE, 0, (LPARAM)(Node))
495 
496 #define TreeNew_SetHotNode(hWnd, Node) \
497  SendMessage((hWnd), TNM_SETHOTNODE, 0, (LPARAM)(Node))
498 
499 #define TreeNew_SetExtendedFlags(hWnd, Mask, Value) \
500  SendMessage((hWnd), TNM_SETEXTENDEDFLAGS, (WPARAM)(Mask), (LPARAM)(Value))
501 
502 #define TreeNew_GetCallback(hWnd, Callback, Context) \
503  SendMessage((hWnd), TNM_GETCALLBACK, (WPARAM)(Context), (LPARAM)(Callback))
504 
505 #define TreeNew_HitTest(hWnd, HitTest) \
506  SendMessage((hWnd), TNM_HITTEST, 0, (LPARAM)(HitTest))
507 
508 #define TreeNew_GetVisibleColumnCount(hWnd) \
509  ((ULONG)SendMessage((hWnd), TNM_GETVISIBLECOLUMNCOUNT, 0, 0))
510 
511 #define TreeNew_AutoSizeColumn(hWnd, Id, Flags) \
512  SendMessage((hWnd), TNM_AUTOSIZECOLUMN, (WPARAM)(Id), (LPARAM)(Flags))
513 
514 #define TreeNew_SetEmptyText(hWnd, Text, Flags) \
515  SendMessage((hWnd), TNM_SETEMPTYTEXT, (WPARAM)(Flags), (LPARAM)(Text))
516 
517 #define TreeNew_SetRowHeight(hWnd, RowHeight) \
518  SendMessage((hWnd), TNM_SETROWHEIGHT, (WPARAM)(RowHeight), 0)
519 
521 {
533 
535  VOID
536  );
537 
539  _In_ PPH_TREENEW_NODE Node
540  )
541 {
542  memset(Node, 0, sizeof(PH_TREENEW_NODE));
543 
544  Node->Visible = TRUE;
545  Node->Expanded = TRUE;
546 }
547 
549  _Inout_ PPH_TREENEW_NODE Node,
550  _In_ ULONG Flags
551  )
552 {
553  if (Flags & TN_CACHE_COLOR)
554  Node->s.CachedColorValid = FALSE;
555  if (Flags & TN_CACHE_FONT)
556  Node->s.CachedFontValid = FALSE;
557  if (Flags & TN_CACHE_ICON)
558  Node->s.CachedIconValid = FALSE;
559 }
560 
561 FORCEINLINE BOOLEAN PhAddTreeNewColumn(
562  _In_ HWND hwnd,
563  _In_ ULONG Id,
564  _In_ BOOLEAN Visible,
565  _In_ PWSTR Text,
566  _In_ ULONG Width,
567  _In_ ULONG Alignment,
568  _In_ ULONG DisplayIndex,
569  _In_ ULONG TextFlags
570  )
571 {
572  PH_TREENEW_COLUMN column;
573 
574  memset(&column, 0, sizeof(PH_TREENEW_COLUMN));
575  column.Id = Id;
576  column.Visible = Visible;
577  column.Text = Text;
578  column.Width = Width;
579  column.Alignment = Alignment;
580  column.DisplayIndex = DisplayIndex;
581  column.TextFlags = TextFlags;
582 
583  if (DisplayIndex == -2)
584  column.Fixed = TRUE;
585 
586  return !!TreeNew_AddColumn(hwnd, &column);
587 }
588 
589 FORCEINLINE BOOLEAN PhAddTreeNewColumnEx(
590  _In_ HWND hwnd,
591  _In_ ULONG Id,
592  _In_ BOOLEAN Visible,
593  _In_ PWSTR Text,
594  _In_ ULONG Width,
595  _In_ ULONG Alignment,
596  _In_ ULONG DisplayIndex,
597  _In_ ULONG TextFlags,
598  _In_ BOOLEAN SortDescending
599  )
600 {
601  PH_TREENEW_COLUMN column;
602 
603  memset(&column, 0, sizeof(PH_TREENEW_COLUMN));
604  column.Id = Id;
605  column.Visible = Visible;
606  column.Text = Text;
607  column.Width = Width;
608  column.Alignment = Alignment;
609  column.DisplayIndex = DisplayIndex;
610  column.TextFlags = TextFlags;
611 
612  if (DisplayIndex == -2)
613  column.Fixed = TRUE;
614  if (SortDescending)
615  column.SortDescending = TRUE;
616 
617  return !!TreeNew_AddColumn(hwnd, &column);
618 }
619 
620 FORCEINLINE BOOLEAN PhAddTreeNewColumnEx2(
621  _In_ HWND hwnd,
622  _In_ ULONG Id,
623  _In_ BOOLEAN Visible,
624  _In_ PWSTR Text,
625  _In_ ULONG Width,
626  _In_ ULONG Alignment,
627  _In_ ULONG DisplayIndex,
628  _In_ ULONG TextFlags,
629  _In_ ULONG ExtraFlags
630  )
631 {
632  PH_TREENEW_COLUMN column;
633 
634  memset(&column, 0, sizeof(PH_TREENEW_COLUMN));
635  column.Id = Id;
636  column.Visible = Visible;
637  column.Text = Text;
638  column.Width = Width;
639  column.Alignment = Alignment;
640  column.DisplayIndex = DisplayIndex;
641  column.TextFlags = TextFlags;
642 
643  if (DisplayIndex == -2)
644  column.Fixed = TRUE;
645  if (ExtraFlags & TN_COLUMN_FLAG_CUSTOMDRAW)
646  column.CustomDraw = TRUE;
647  if (ExtraFlags & TN_COLUMN_FLAG_SORTDESCENDING)
648  column.SortDescending = TRUE;
649 
650  return !!TreeNew_AddColumn(hwnd, &column);
651 }
652 
653 #endif