Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion package/AgentWindowsManaged/Actions/AgentActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ internal static class AgentActions
Impersonate = false,
};

private static readonly ManagedAction launchDesktopApp = new(
CustomActions.LaunchDesktopApp,
Return.ignore,
When.After, Step.InstallFinalize,
Condition.NOT_Installed & new Condition("(UILevel >= 3 OR WIXSHARP_MANAGED_UI_HANDLE <> \"\")"),
Sequence.InstallExecuteSequence)
{
Execute = Execute.immediate,
Impersonate = true,
};

/// <summary>
/// Start the installed DevolutionsAgent service
/// </summary>
Expand All @@ -215,7 +226,7 @@ internal static class AgentActions
/// This was necessary in the old Wayk installer to reread configurations that may have been updated
/// by the installer. It's usefulness os questionable with Devolutions Agent.
/// </remarks>
private static readonly ElevatedManagedAction restartAgent= new(
private static readonly ElevatedManagedAction restartAgent = new(
CustomActions.RestartAgent,
Return.ignore,
When.After, Step.StartServices,
Expand Down Expand Up @@ -330,6 +341,7 @@ private static string UseProperties(IEnumerable<IWixProperty> properties)
cleanAgentConfigIfNeededRollback,
shutdownDesktopApp,
startAgentIfNeeded,
launchDesktopApp,
restartAgent,
rollbackConfig,
};
Expand Down
39 changes: 39 additions & 0 deletions package/AgentWindowsManaged/Actions/CustomActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,45 @@ public static ActionResult GetInstalledNetFx45Version(Session session)
return ActionResult.Success;
}

[CustomAction]
public static ActionResult LaunchDesktopApp(Session session)
{
try
{
string installDir = session.Property(AgentProperties.InstallDir);

if (string.IsNullOrEmpty(installDir))
{
session.Log("skipping launch of desktop application due to empty install dir");
return ActionResult.Success;
}

string path = Path.Combine(installDir, Includes.DESKTOP_DIRECTORY_NAME, Includes.DESKTOP_EXECUTABLE_NAME);

if (!File.Exists(path))
{
session.Log($"skipping launch of desktop application due to missing executable at {path}");
return ActionResult.Success;
}

ProcessStartInfo startInfo = new ProcessStartInfo(path)
{
WorkingDirectory = Path.Combine(installDir, Includes.DESKTOP_DIRECTORY_NAME),
UseShellExecute = true,
};

Process.Start(startInfo);

return ActionResult.Success;
}
catch (Exception e)
{
session.Log($"unexpected error launching desktop application {e}");
return ActionResult.Failure;
}

}

static ActionResult ToggleAgentFeature(Session session, string feature, bool enable)
{
string path = Path.Combine(ProgramDataDirectory, "agent.json");
Expand Down
4 changes: 2 additions & 2 deletions package/AgentWindowsManaged/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static void Main()
},
Dirs = new[]
{
new Dir(Features.AGENT_FEATURE, "desktop", new Files(Features.AGENT_FEATURE, $"{DevolutionsDesktopAgentPath}\\*.*")),
new Dir(Features.AGENT_FEATURE, Includes.DESKTOP_DIRECTORY_NAME, new Files(Features.AGENT_FEATURE, $"{DevolutionsDesktopAgentPath}\\*.*")),
new Dir(Features.PEDM_FEATURE, "ShellExt",
new File(Features.PEDM_FEATURE, DevolutionsPedmShellExtDll),
new File(Features.PEDM_FEATURE, DevolutionsPedmShellExtMsix)),
Expand All @@ -310,7 +310,7 @@ static void Main()
Win64 = project.Platform == Platform.x64,
RegistryKeyAction = RegistryKeyAction.create,
},
new (RegistryHive.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", Includes.SERVICE_NAME, $"[{AgentProperties.InstallDir}]desktop\\{Includes.DESKTOP_EXECUTABLE_NAME}")
new (RegistryHive.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", Includes.SERVICE_NAME, $"[{AgentProperties.InstallDir}]{Includes.DESKTOP_DIRECTORY_NAME}\\{Includes.DESKTOP_EXECUTABLE_NAME}")
{
Win64 = project.Platform == Platform.x64,
RegistryKeyAction = RegistryKeyAction.create,
Expand Down
34 changes: 18 additions & 16 deletions package/AgentWindowsManaged/Resources/Includes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,35 @@ namespace DevolutionsAgent.Resources
{
internal static class Includes
{
internal static string VENDOR_NAME = "Devolutions";
internal static readonly string VENDOR_NAME = "Devolutions";

internal static string PRODUCT_NAME = "Devolutions Agent";
internal static readonly string PRODUCT_NAME = "Devolutions Agent";

internal static string SHORT_NAME = "Agent";
internal static readonly string SHORT_NAME = "Agent";

internal static string SERVICE_NAME = "DevolutionsAgent";
internal static readonly string SERVICE_NAME = "DevolutionsAgent";

internal static string SERVICE_DISPLAY_NAME = "Devolutions Agent Service";
internal static readonly string SERVICE_DISPLAY_NAME = "Devolutions Agent Service";

internal static string SERVICE_DESCRIPTION = "Devolutions Agent Service";
internal static readonly string SERVICE_DESCRIPTION = "Devolutions Agent Service";

internal static string EXECUTABLE_NAME = "DevolutionsAgent.exe";
internal static readonly string EXECUTABLE_NAME = "DevolutionsAgent.exe";

internal static string DESKTOP_EXECUTABLE_NAME = "DevolutionsDesktopAgent.exe";
internal static readonly string DESKTOP_DIRECTORY_NAME = "desktop";

internal static string EMAIL_SUPPORT = "support@devolutions.net";
internal static readonly string DESKTOP_EXECUTABLE_NAME = "DevolutionsDesktopAgent.exe";

internal static string FORUM_SUPPORT = "forum.devolutions.net";
internal static readonly string EMAIL_SUPPORT = "support@devolutions.net";

internal static string SHELL_EXT_BINARY_NAME = "DevolutionsPedmShellExt.dll";
internal static readonly string FORUM_SUPPORT = "forum.devolutions.net";

internal static Guid SHELL_EXT_CSLID = new("0BA604FD-4A5A-4ABB-92B1-09AC5C3BF356");
internal static readonly string SHELL_EXT_BINARY_NAME = "DevolutionsPedmShellExt.dll";

internal static Guid UPGRADE_CODE = new("82318d3c-811f-4d5d-9a82-b7c31b076755");
internal static readonly Guid SHELL_EXT_CSLID = new("0BA604FD-4A5A-4ABB-92B1-09AC5C3BF356");

internal static string INFO_URL = "https://server.devolutions.net";
internal static readonly Guid UPGRADE_CODE = new("82318d3c-811f-4d5d-9a82-b7c31b076755");

internal static readonly string INFO_URL = "https://server.devolutions.net";

/// <summary>
/// SDDL string representing desired %programdata%\devolutions\agent ACL
Expand All @@ -45,7 +47,7 @@ internal static class Includes
/// BUILTIN\Administrators Allow FullControl
/// BUILTIN\Users Allow ReadAndExecute, Synchronize
/// </remarks>
internal static string PROGRAM_DATA_SDDL = "O:SYG:SYD:PAI(A;OICI;FA;;;SY)(A;OICI;0x1201bf;;;LS)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;BU)";
internal static readonly string PROGRAM_DATA_SDDL = "O:SYG:SYD:PAI(A;OICI;FA;;;SY)(A;OICI;0x1201bf;;;LS)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;BU)";

/// <summary>
/// SDDL string representing desired %programdata%\devolutions\agent\pedm ACL
Expand All @@ -57,6 +59,6 @@ internal static class Includes
/// Access :
/// NT AUTHORITY\SYSTEM Allow FullControl
/// </remarks>
internal static string PROGRAM_DATA_PEDM_SDDL = "O:SYG:SYD:(A;OICI;FA;;;SY)";
internal static readonly string PROGRAM_DATA_PEDM_SDDL = "O:SYG:SYD:(A;OICI;FA;;;SY)";
}
}