Skip to content

Commit 34dc389

Browse files
authored
Fix: Fixed an issue with admin operations not working (#13545)
1 parent 12c352a commit 34dc389

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Files.App/Dialogs/ElevateConfirmDialog.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
<Style BasedOn="{StaticResource AccentButtonStyle}" TargetType="Button">
2222
<Setter Property="ContentTemplate">
2323
<Setter.Value>
24-
<DataTemplate x:DataType="ContentDialog">
24+
<DataTemplate>
2525
<StackPanel Orientation="Horizontal" Spacing="5">
2626
<FontIcon FontSize="14" Glyph="&#xEA18;" />
27-
<TextBlock Text="{x:Bind PrimaryButtonText, Mode=OneWay}" />
27+
<TextBlock Text="{Binding Content, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
2828
</StackPanel>
2929
</DataTemplate>
3030
</Setter.Value>

src/Files.App/Utils/Shell/ShellFileOperations2.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public class ShellFileOperations2 : IDisposable
2222
/// <param name="owner">The window that owns the modal dialog. This value can be <see langword="null"/>.</param>
2323
public ShellFileOperations2(HWND owner = default)
2424
{
25-
op = new IFileOperation();
25+
// EDIT: use CoCreateInstance to explicitly create object with CLSCTX_LOCAL_SERVER (fixes #13229, hides UAC)
26+
Ole32.CoCreateInstance(typeof(CFileOperations).GUID, null, Ole32.CLSCTX.CLSCTX_LOCAL_SERVER, typeof(IFileOperation).GUID, out var opObj);
27+
op = (IFileOperation)opObj;
28+
//op = new IFileOperation();
2629
if (owner != default)
2730
{
2831
op.SetOwnerWindow(owner);
@@ -712,6 +715,7 @@ internal ShellFileOpEventArgs(TRANSFER_SOURCE_FLAGS flags, IShellItem source, IS
712715

713716
public delegate void ProgressChangedEventHandler(object? sender, ProgressChangedEventArgs e);
714717

718+
// From System.ComponentModel.ProgressChangedEventArgs but with double percentage
715719
public class ProgressChangedEventArgs : EventArgs
716720
{
717721
private readonly double _progressPercentage;

0 commit comments

Comments
 (0)