mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-11 00:51:29 +03:00
Feat. msi (#7584)
* Feat. msi Signed-off-by: fufesou <shuanglongchen@yeah.net> * remove ununsed file Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
56
res/msi/CustomActions/CustomAction.cs
Normal file
56
res/msi/CustomActions/CustomAction.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using WixToolset.Dtf.WindowsInstaller;
|
||||
|
||||
namespace CustomActions
|
||||
{
|
||||
public class CustomActions
|
||||
{
|
||||
[CustomAction]
|
||||
public static ActionResult CustomActionHello(Session session)
|
||||
{
|
||||
try
|
||||
{
|
||||
session.Log("================= Example CustomAction Hello");
|
||||
return ActionResult.Success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
session.Log("An error occurred: " + e.Message);
|
||||
return ActionResult.Failure;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomAction]
|
||||
public static ActionResult RunCommandAsSystem(Session session)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
|
||||
FileName = "cmd.exe",
|
||||
Arguments = "/c " + session["CMD"],
|
||||
UseShellExecute = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
Verb = "runas"
|
||||
};
|
||||
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
return ActionResult.Success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
session.Log("An error occurred: " + e.Message);
|
||||
return ActionResult.Failure;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user