Run Settings on same elevation as PowerToys.exe (#9184)

* Run Settings on same elevation as PowerToys.exe

* Only apply the fix when running the new Settings
This commit is contained in:
Ivan Stošić 2021-01-20 19:28:14 +01:00 committed by GitHub
parent a434d6047f
commit 5eb95f836e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -386,7 +386,11 @@ void run_settings_window()
executable_args.append(settings_isUserAnAdmin);
BOOL process_created = false;
if (is_process_elevated())
// Due to a bug in .NET, running the Settings process as non-elevated
// from an elevated process sometimes results in a crash.
// TODO: Revisit this after switching to .NET 5
if (is_process_elevated() && !UseNewSettings())
{
process_created = run_settings_non_elevated(executable_path.c_str(), executable_args.data(), &process_info);
}