-
Notifications
You must be signed in to change notification settings - Fork 357
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
Add background elevated process for setup flow #59
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
# Conflicts: # tools/SetupFlow/DevHome.SetupFlow.RepoConfig/Models/CloneRepoTask.cs # tools/SetupFlow/DevHome.SetupFlow.Summary/ViewModels/SummaryViewModel.cs # tools/SetupFlow/DevHome.SetupFlow.UnitTest/ViewModels/SearchViewModelTest.cs
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
# Conflicts: # src/DevHome.csproj # tools/SetupFlow/DevHome.SetupFlow.Common/Services/SetupFlowOrchestrator.cs # tools/SetupFlow/DevHome.SetupFlow.Common/ViewModels/SetupPageViewModelBase.cs # tools/SetupFlow/DevHome.SetupFlow.Summary/ViewModels/SummaryViewModel.cs # tools/SetupFlow/DevHome.SetupFlow/ViewModels/SetupFlowViewModel.cs
# Conflicts: # DevHome.sln # tools/SetupFlow/DevHome.SetupFlow.AppManagement/Models/InstallPackageTask.cs
# Conflicts: # DevHome.sln # src/DevHome.csproj
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
...SetupFlow.ElevatedComponent.Projection/DevHome.SetupFlow.ElevatedComponent.Projection.csproj
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent.Setup/IPCSetup.cs
Outdated
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/ElevatedComponentFactory.cs
Outdated
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent.Setup/IPCSetup.cs
Outdated
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.Summary/ViewModels/SummaryViewModel.cs
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.UnitTest/BackgroundProcessTest.cs
Outdated
Show resolved
Hide resolved
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is its own exe, you are probably going to have to make this self-contained too similar to the main dev home app via a publish profile.
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent.Setup/IPCSetup.cs
Outdated
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/ElevatedComponentFactory.cs
Show resolved
Hide resolved
I've tested this and worked with Flor to confirm it works as intended to create dev drives. @AmelBawa-msft I believe you should be able to install apps with this as well, but you'll have to test it out. I'm sure if there are any runtime problems we'll continue to iterate on this. As currently constructed I have no problems. @manodasanW are you able to take a look again? For me I can approve once the merge conflicts are solved |
# Conflicts: # tools/SetupFlow/DevHome.SetupFlow.AppManagement/Models/InstallPackageTask.cs # tools/SetupFlow/DevHome.SetupFlow.Common/Models/ISetupTask.cs # tools/SetupFlow/DevHome.SetupFlow.Loading/ViewModels/LoadingViewModel.cs # tools/SetupFlow/DevHome.SetupFlow.RepoConfig/Models/CloneRepoTask.cs
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Summary of the pull request
Added a process that runs elevated in the background during the setup flow to execute any tasks that require admin permissions. Having this background process to offload work to lets us have a single UAC prompt when starting the setup.
References and relevant issues
Detailed description of the pull request / Additional comments
When starting the setup, if any of the tasks to execute requires admin, we start this process and establish communication with it by having an object on the background process and a proxy for it on the main app process. The interface for this object can be extended as needed for all the tasks that need admin (install apps, create dev drive). See the comment at the top of IPCSetup.cs for details of how this is set up.
Extended the ISetupTask interface with an ExecuteAsAdmin() method. This method takes the remote factory as a parameter. To implement it, one would add a new type to the elevated component to handle the required steps, add a corresponding Create*() method on the factory interface to create an object of that type, and then use that in the ExecuteAsAdmin() method.
Validation steps performed
As there are no current implementations for tasks that run as admin, I temporarily modified the code to always launch the elevated process when starting the setup and added a test method to print a string. Manually verified that the process was started, and that calling the test method from the main app would print the message on the elevated process' windows.
Added a test that starts the process, calls this test method to print something, then checks the process output.
PR checklist
Closes #xxxNo related issue