Skip to content

Commit fe482bc

Browse files
committed
WindowExplorer: Fix searching hidden window nodes
1 parent 9f544f0 commit fe482bc

4 files changed

Lines changed: 19 additions & 31 deletions

File tree

plugins/WindowExplorer/wnddlg.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ VOID WepFillWindowInfo(
119119
Node->HasChildren = !!FindWindowEx(hwnd, NULL, NULL, NULL);
120120
}
121121

122-
VOID WepAddChildWindowNode(
122+
PWE_WINDOW_NODE WepAddChildWindowNode(
123123
_In_ PWE_WINDOW_TREE_CONTEXT Context,
124124
_In_opt_ PWE_WINDOW_NODE ParentNode,
125125
_In_ HWND hwnd
@@ -129,21 +129,26 @@ VOID WepAddChildWindowNode(
129129

130130
childNode = WeAddWindowNode(Context);
131131
childNode->WindowHandle = hwnd;
132-
WepFillWindowInfo(childNode);
133132

134-
childNode->Node.Expanded = FALSE;
133+
WepFillWindowInfo(childNode);
135134

136135
if (ParentNode)
137136
{
138137
// This is a child node.
138+
childNode->Node.Expanded = FALSE;
139139
childNode->Parent = ParentNode;
140+
140141
PhAddItemList(ParentNode->Children, childNode);
141142
}
142143
else
143144
{
144145
// This is a root node.
146+
childNode->Node.Expanded = TRUE;
147+
145148
PhAddItemList(Context->NodeRootList, childNode);
146149
}
150+
151+
return childNode;
147152
}
148153

149154
VOID WepAddChildWindows(
@@ -171,7 +176,12 @@ VOID WepAddChildWindows(
171176
(!FilterThreadId || UlongToHandle(threadId) == FilterThreadId)
172177
)
173178
{
174-
WepAddChildWindowNode(&Context->TreeContext, ParentNode, childWindow);
179+
PWE_WINDOW_NODE childNode = WepAddChildWindowNode(&Context->TreeContext, ParentNode, childWindow);
180+
181+
if (childNode->HasChildren)
182+
{
183+
WepAddChildWindows(Context, childNode, childWindow, NULL, NULL);
184+
}
175185
}
176186

177187
i++;
@@ -210,7 +220,6 @@ VOID WepRefreshWindows(
210220
{
211221
TreeNew_SetRedraw(Context->TreeNewHandle, FALSE);
212222
WeClearWindowTree(&Context->TreeContext);
213-
TreeNew_NodesStructured(Context->TreeNewHandle);
214223

215224
switch (Context->Selector.Type)
216225
{
@@ -227,7 +236,6 @@ VOID WepRefreshWindows(
227236
WepAddChildWindows(Context, desktopNode, desktopNode->WindowHandle, NULL, NULL);
228237

229238
desktopNode->HasChildren = TRUE;
230-
desktopNode->Opened = TRUE;
231239
}
232240
break;
233241
case WeWindowSelectorThread:
@@ -247,6 +255,7 @@ VOID WepRefreshWindows(
247255
break;
248256
}
249257

258+
TreeNew_NodesStructured(Context->TreeNewHandle);
250259
TreeNew_SetRedraw(Context->TreeNewHandle, TRUE);
251260
}
252261

@@ -401,7 +410,7 @@ INT_PTR CALLBACK WepWindowsDlgProc(
401410
PhApplyTreeNewFilters(&context->TreeContext.FilterSupport);
402411

403412
TreeNew_NodesStructured(context->TreeNewHandle);
404-
// PhInvokeCallback(&SearchChangedEvent, SearchboxText);
413+
// PhInvokeCallback(&SearchChangedEvent, SearchboxText);
405414
}
406415
}
407416
break;
@@ -745,19 +754,6 @@ INT_PTR CALLBACK WepWindowsDlgProc(
745754
PhResizingMinimumSize((PRECT)lParam, wParam, MinimumSize.right, MinimumSize.bottom);
746755
}
747756
break;
748-
case WM_WE_PLUSMINUS:
749-
{
750-
PWE_WINDOW_NODE node = (PWE_WINDOW_NODE)lParam;
751-
752-
if (!node->Opened)
753-
{
754-
TreeNew_SetRedraw(context->TreeNewHandle, FALSE);
755-
WepAddChildWindows(context, node, node->WindowHandle, NULL, NULL);
756-
node->Opened = TRUE;
757-
TreeNew_SetRedraw(context->TreeNewHandle, TRUE);
758-
}
759-
}
760-
break;
761757
}
762758

763759
return FALSE;

plugins/WindowExplorer/wndexp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ VOID WeShowWindowsDialog(
100100
_In_ PWE_WINDOW_SELECTOR Selector
101101
);
102102

103-
#define WM_WE_PLUSMINUS (WM_APP + 1)
104-
105103
// wndprp
106104

107105
VOID WeShowWindowProperties(

plugins/WindowExplorer/wndtree.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ VOID WeInitializeWindowTree(
151151
PhAddTreeNewColumn(hwnd, WEWNTLC_THREAD, TRUE, L"Thread", 150, PH_ALIGN_LEFT, 3, 0);
152152

153153
TreeNew_SetTriState(hwnd, TRUE);
154-
TreeNew_SetSort(hwnd, 0, NoSortOrder);
154+
TreeNew_SetSort(hwnd, WEWNTLC_CLASS, NoSortOrder);
155155

156156
settings = PhGetStringSetting(SETTING_NAME_WINDOW_TREE_LIST_COLUMNS);
157157
PhCmLoadSettings(hwnd, &settings->sr);
@@ -233,7 +233,7 @@ PWE_WINDOW_NODE WeAddWindowNode(
233233
if (Context->FilterSupport.FilterList)
234234
windowNode->Node.Visible = PhApplyTreeNewFiltersToNode(&Context->FilterSupport, &windowNode->Node);
235235

236-
TreeNew_NodesStructured(Context->TreeNewHandle);
236+
//TreeNew_NodesStructured(Context->TreeNewHandle);
237237

238238
return windowNode;
239239
}
@@ -477,11 +477,6 @@ BOOLEAN NTAPI WepWindowTreeNewCallback(
477477
SendMessage(context->ParentWindowHandle, WM_COMMAND, ID_WINDOW_PROPERTIES, 0);
478478
}
479479
return TRUE;
480-
case TreeNewNodeExpanding:
481-
{
482-
SendMessage(context->ParentWindowHandle, WM_WE_PLUSMINUS, 0, (LPARAM)Parameter1);
483-
}
484-
return FALSE;
485480
case TreeNewContextMenu:
486481
{
487482
PPH_TREENEW_MOUSE_EVENT mouseEvent = Parameter1;

plugins/WindowExplorer/wndtree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ typedef struct _WE_WINDOW_NODE
2020
struct
2121
{
2222
ULONG HasChildren : 1;
23-
ULONG Opened : 1;
2423
ULONG WindowVisible : 1;
25-
ULONG Spare : 29;
24+
ULONG Spare : 30;
2625
};
2726
};
2827

0 commit comments

Comments
 (0)