[PR #14637] Launch elevated instances via shell:AppFolder #30178

Open
opened 2026-01-31 09:39:08 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14637

State: closed
Merged: Yes


This uses shell:AppsFolder to launch elevated instances of the app via
ShellExecuteEx and runas in elevate-shim.exe. The app to launch is
discovered via the GetCurrentApplicationUserModelId API.

e.g. shell:AppsFolder\WindowsTerminalDev_8wekyb3d8bbwe!App

This will fallback to launching WindowsTerminal.exe if it fails to
discover the app user model id to launch.

This also fixes a bug in elevate-shim where the first argument of
WinMain was lost (e.g. new-tab).

Curiously, AppLogic::RunAsUwp() is never called and
AppLogic::IsUwp() is always false when running debug builds locally
(e.g. WindowsTerminalDev). It's not clear if this is an artifact of
development packages or something else.

Validation Steps Performed

Various manual debug/execution scenarios.

Verified the fallback path by running the unbundled app by extracting
the CascadiaPackage_0.0.1.0_x64.msix from the 'drop' build artifact.

Fixes #14501

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14637 **State:** closed **Merged:** Yes --- This uses `shell:AppsFolder` to launch elevated instances of the app via `ShellExecuteEx` and `runas` in elevate-shim.exe. The app to launch is discovered via the `GetCurrentApplicationUserModelId` API. e.g. `shell:AppsFolder\WindowsTerminalDev_8wekyb3d8bbwe!App` This will fallback to launching `WindowsTerminal.exe` if it fails to discover the app user model id to launch. This also fixes a bug in elevate-shim where the first argument of WinMain was lost (e.g. `new-tab`). Curiously, `AppLogic::RunAsUwp()` is never called and `AppLogic::IsUwp()` is always false when running debug builds locally (e.g. WindowsTerminalDev). It's not clear if this is an artifact of development packages or something else. ## Validation Steps Performed Various manual debug/execution scenarios. Verified the fallback path by running the unbundled app by extracting the `CascadiaPackage_0.0.1.0_x64.msix` from the 'drop' build artifact. Fixes #14501
claunia added the pull-request label 2026-01-31 09:39:08 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30178