Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSIX] "Restart as user" fails when PT is running as admin #1325

Closed
enricogior opened this issue Feb 19, 2020 · 4 comments
Closed

[MSIX] "Restart as user" fails when PT is running as admin #1325

enricogior opened this issue Feb 19, 2020 · 4 comments
Assignees
Labels
Area-Runner The PowerToys main executable Issue-Bug Something isn't working Product-Settings The standalone PowerToys Settings application Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@enricogior
Copy link
Contributor

enricogior commented Feb 19, 2020

This applies to the current master and to PT is it's installed using the MSIX package.
By default PT runs non-elevated. If the user is an admin, PT can be executed with elevated privileges. In that case there is an option to restart PT non-elevated (aka "Run as user").
The command fails to restart PT. In some cases it does restart PT but the Settings are not accessible.

@enricogior enricogior added Issue-Bug Something isn't working Product-Settings The standalone PowerToys Settings application Area-Runner The PowerToys main executable Status-In progress This issue or work-item is under development labels Feb 19, 2020
@yuyoyuppe
Copy link
Collaborator

The current way of dropping privileges doesn't work in MSIX context - we need to use CreateProcessAsUserW/CreateProcessWithTokenW. After initial research, it looks like these functions don't work correctly in a packaged context either. It may be possible to make them work in a packaged context, but it will take some time to research what exactly is wrong there.

There's also another possible way to workaround this: launch a UWP background task, which in turn will launch a URI with a custom schema, which will be "handled" by a new non-elevated instance of PT. It's a bit ugly workaround imo.

Since it's much more important to be able to restart elevated than vise versa, I'd suggest we simply hide the "Restart as a user" button in an elevated context.

@enricogior
Copy link
Contributor Author

enricogior commented Feb 19, 2020

Since it's much more important to be able to restart elevated than vise versa, I'd suggest we simply hide the "Restart as a user" button in an elevated context.

We can always reconsider it for 0.16, but for 0.15 seems the best solution.
We have the fix ready for it.

@yuyoyuppe yuyoyuppe added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Feb 19, 2020
@yuyoyuppe yuyoyuppe self-assigned this Feb 19, 2020
@yuyoyuppe yuyoyuppe added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. labels Feb 19, 2020
@enricogior
Copy link
Contributor Author

This has been resolved disabling the feature. We will open a new issue to track bringing back the feature in a upcoming milestone.

@enricogior
Copy link
Contributor Author

Fix available in 0.15.0 https://github.com/microsoft/PowerToys/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Runner The PowerToys main executable Issue-Bug Something isn't working Product-Settings The standalone PowerToys Settings application Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

2 participants