Skip to content

Commit

Permalink
fix #2074
Browse files Browse the repository at this point in the history
  • Loading branch information
DartVanya committed Nov 22, 2024
1 parent 53fe931 commit 165f3a5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
8 changes: 5 additions & 3 deletions phlib/delayhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,9 @@ LRESULT CALLBACK PhEditWindowHookProcedure(
RECT windowRect;
HRGN updateRegion;

// The searchbox control does its own theme drawing.
if (!PhEnableThemeSupport || PhGetWindowContext(WindowHandle, SHRT_MAX))
if (!PhEnableThemeSupport ||
PhGetWindowContext(WindowHandle, SHRT_MAX) || // The searchbox control does its own theme drawing.
!PhIsDarkModeAllowedForWindow(WindowHandle)) // Unsupported system dialogs does its own drawing
break;

updateRegion = (HRGN)wParam;
Expand Down Expand Up @@ -969,7 +970,7 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(

PhSetControlTheme(WindowHandle, PhEnableThemeSupport ? L"DarkMode_ItemsView" : L"Explorer");
}
else if (PhEnableThemeSupport)
else if (PhEnableThemeSupport || WindowMessage == WM_NCDESTROY)
{
context = PhGetWindowContext(WindowHandle, LONG_MAX);
}
Expand Down Expand Up @@ -1058,6 +1059,7 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
PhRemoveWindowContext(WindowHandle, LONG_MAX);
if (context->ThemeHandle)
PhCloseThemeData(context->ThemeHandle);
PhSetControlTheme(WindowHandle, L"Explorer");
PhFree(context);
break;
}
Expand Down
3 changes: 3 additions & 0 deletions phlib/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
{
SendMessage(WindowHandle, WM_THEMECHANGED, 0, 0); // searchbox.c
}

PhAllowDarkModeForWindow(WindowHandle, enableThemeSupport); // fix for unsupported system dialogs (ex. Advanced Security)
}
else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
{
Expand Down Expand Up @@ -3182,6 +3184,7 @@ LRESULT CALLBACK PhpThemeWindowComboBoxControlSubclassProc(
goto DefaultWndProc;
}

// BUG BUG BUG fix
return CallWindowProc(oldWndProc, WindowHandle, uMsg, wParam, lParam);

DefaultWndProc:
Expand Down
17 changes: 14 additions & 3 deletions plugins/ExtendedTools/objmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ NTSTATUS EtTreeViewEnumDirectoryObjects(
if (NT_SUCCESS(status))
{
DIRECTORY_ENUM_CONTEXT enumContext;

enumContext.TreeViewHandle = TreeViewHandle;
enumContext.RootTreeItem = RootTreeItem;
enumContext.DirectoryPath = DirectoryPath;
Expand All @@ -708,9 +707,21 @@ NTSTATUS EtTreeViewEnumDirectoryObjects(
);

NtClose(directoryHandle);
}

TreeView_SortChildren(TreeViewHandle, RootTreeItem, TRUE);
TreeView_SortChildren(TreeViewHandle, RootTreeItem, TRUE); // add ?? item last

if (PhEqualStringRef(&DirectoryPath, &EtObjectManagerRootDirectoryObject, FALSE))
{
enumContext.DirectoryPath = EtObjectManagerRootDirectoryObject;

// enumerate \??
EtEnumDirectoryObjectsCallback(
&EtObjectManagerUserDirectoryObject,
&DirectoryObjectType,
&enumContext
);
}
}

return status;
}
Expand Down

0 comments on commit 165f3a5

Please sign in to comment.