From 7ed2434db7089cabb552ec12636d88fdc3463485 Mon Sep 17 00:00:00 2001 From: Damir Ainullin Date: Sun, 17 Feb 2019 16:53:12 +0300 Subject: [PATCH 1/2] Marked ApplicationRestartFlags with Flags attribute --- shadowsocks-csharp/Controller/System/AutoStartup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shadowsocks-csharp/Controller/System/AutoStartup.cs b/shadowsocks-csharp/Controller/System/AutoStartup.cs index 9f3e5ff2..e2031788 100644 --- a/shadowsocks-csharp/Controller/System/AutoStartup.cs +++ b/shadowsocks-csharp/Controller/System/AutoStartup.cs @@ -115,6 +115,7 @@ namespace Shadowsocks.Controller [DllImport("kernel32.dll", SetLastError = true)] static extern int UnregisterApplicationRestart(); + [Flags] enum ApplicationRestartFlags { RESTART_NO_CRASH = 1, @@ -137,7 +138,7 @@ namespace Shadowsocks.Controller string cmdline = string.Join(" ", args); // first parameter is process command line parameter // needn't include the name of the executable in the command line - RegisterApplicationRestart(cmdline, (int)ApplicationRestartFlags.RESTART_NO_CRASH | (int)ApplicationRestartFlags.RESTART_NO_HANG); + RegisterApplicationRestart(cmdline, (int)(ApplicationRestartFlags.RESTART_NO_CRASH | ApplicationRestartFlags.RESTART_NO_HANG)); Logging.Debug("Register restart after system reboot, command line:" + cmdline); } // requested unregister, which has no side effect From 5a2adf749c41661e4d3fbb53fe262d8486f12a31 Mon Sep 17 00:00:00 2001 From: Damir Ainullin Date: Fri, 22 Feb 2019 00:52:33 +0300 Subject: [PATCH 2/2] Added flag RESTART_ALWAYS = 0 for ApplicationRestartFlags --- shadowsocks-csharp/Controller/System/AutoStartup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/shadowsocks-csharp/Controller/System/AutoStartup.cs b/shadowsocks-csharp/Controller/System/AutoStartup.cs index e2031788..310a3c71 100644 --- a/shadowsocks-csharp/Controller/System/AutoStartup.cs +++ b/shadowsocks-csharp/Controller/System/AutoStartup.cs @@ -118,6 +118,7 @@ namespace Shadowsocks.Controller [Flags] enum ApplicationRestartFlags { + RESTART_ALWAYS = 0, RESTART_NO_CRASH = 1, RESTART_NO_HANG = 2, RESTART_NO_PATCH = 4,