Skip to content

Commit 2d69ec2

Browse files
Add support for AdminByRequest on Elevator (fix System.InvalidOperationException, fix #3913, related to #3441)
Co-Authored-By: Bart Jolling <[email protected]>
1 parent b3df695 commit 2d69ec2

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

src/UniGetUI.Core.Settings/SettingsEngine_Names.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public enum K
8282
InstallInstalledPackagesBundlesPage,
8383
ProhibitElevation,
8484
DisableIntegrityChecks,
85+
UseLegacyElevator,
8586

8687
Test1,
8788
Test2,
@@ -90,7 +91,7 @@ public enum K
9091
Test5,
9192
Test6,
9293
Test7_Legacy,
93-
Unset
94+
Unset,
9495
};
9596

9697
public static string ResolveKey(K key)
@@ -175,6 +176,7 @@ public static string ResolveKey(K key)
175176
K.InstallInstalledPackagesBundlesPage => "InstallInstalledPackagesBundlesPage",
176177
K.ProhibitElevation => "ProhibitElevation",
177178
K.DisableIntegrityChecks => "DisableIntegrityChecks",
179+
K.UseLegacyElevator => "UseLegacyElevator",
178180

179181
K.Test1 => "TestSetting1",
180182
K.Test2 => "TestSetting2",

src/UniGetUI/App.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ private static async Task LoadGSudo()
117117
Logger.Warn($"Using bundled GSudo at {CoreData.ElevatorPath} since UniGetUI Elevator is not available!");
118118
CoreData.ElevatorPath = (await CoreTools.WhichAsync("gsudo.exe")).Item2;
119119
#else
120-
CoreData.ElevatorPath = Path.Join(CoreData.UniGetUIExecutableDirectory, "Assets", "Utilities",
121-
"UniGetUI Elevator.exe");
120+
string elevatorKind = Settings.Get(Settings.K.UseLegacyElevator)
121+
? "UniGetUI Elevator (Legacy).exe"
122+
: "UniGetUI Elevator.exe";
123+
CoreData.ElevatorPath = Path.Join(CoreData.UniGetUIExecutableDirectory, "Assets", "Utilities", elevatorKind);
122124
Logger.Debug($"Using built-in UniGetUI Elevator at {CoreData.ElevatorPath}");
123125
#endif
124126
}
4.48 MB
Binary file not shown.
73.5 KB
Binary file not shown.

src/UniGetUI/Pages/SettingsPages/GeneralPages/Experimental.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@
5555

5656
<widgets:SecureCheckboxCard
5757
x:Name="UseUserGSudoToggle"
58-
CornerRadius="8"
58+
CornerRadius="8,8,0,0"
59+
BorderThickness="1,1,1,0"
5960
SettingName="ForceUserGSudo"
6061
StateChanged="ShowRestartBanner"
6162
Text="Use installed GSudo instead of UniGetUI Elevator" />
6263

63-
<UserControl Height="16" />
64-
6564
<widgets:CheckboxCard
66-
CornerRadius="8"
67-
SettingName="DisableNewProcessLineHandler"
68-
Text="Enable the new process input handler (StdIn automated closer)" />
65+
CornerRadius="0,0,8,8"
66+
SettingName="UseLegacyElevator"
67+
Text="Use legacy UniGetUI Elevator (disable AdminByRequest support)" />
68+
6969
<UserControl Height="16" />
7070

7171
<widgets:CheckboxCard

src/UniGetUI/UniGetUI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@
179179
<None Update="Assets\Images\*.ico">
180180
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
181181
</None>
182-
<None Update="Assets\Utilities\gsudo.exe">
183-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
184-
</None>
185182
<None Update="Assets\Utilities\install_scoop.cmd">
186183
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
187184
</None>
@@ -313,6 +310,9 @@
313310
</Content>
314311
<Content Update="Assets\Utilities\UniGetUI Elevator.exe">
315312
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
313+
</Content>
314+
<Content Update="Assets\Utilities\UniGetUI Elevator (Legacy).exe">
315+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
316316
</Content>
317317
<Content Update="Assets\Utilities\getfilesiginforedist.dll">
318318
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

0 commit comments

Comments
 (0)