From 3417a984fa81dc89d984aa3fd3728e90a92d79fb Mon Sep 17 00:00:00 2001 From: Syrone Wong Date: Wed, 17 Aug 2016 10:28:27 +0800 Subject: [PATCH] Change requirements - Running on Windows Vista or above Signed-off-by: Syrone Wong --- shadowsocks-csharp/Data/cn.txt | 1 + shadowsocks-csharp/Program.cs | 8 ++++++++ shadowsocks-csharp/Util/Util.cs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index d471863a..c7ef11a5 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -113,5 +113,6 @@ Failed to update registry=无法修改注册表 System Proxy On: =系统代理已启用: Running: Port {0}=正在运行:端口 {0} Unexpected error, shadowsocks will exit. Please report to=非预期错误,Shadowsocks将退出。请提交此错误到 +Unsupported operating system, use Windows Vista at least.=不支持的操作系统版本,最低需求为Windows Vista。 Proxy request failed=代理请求失败 Proxy handshake failed=代理握手失败 diff --git a/shadowsocks-csharp/Program.cs b/shadowsocks-csharp/Program.cs index be7e2afe..ee5465dc 100755 --- a/shadowsocks-csharp/Program.cs +++ b/shadowsocks-csharp/Program.cs @@ -18,6 +18,14 @@ namespace Shadowsocks [STAThread] static void Main() { + // Check OS since we are using dual-mode socket + if (!Utils.IsWinVistaOrHigher()) + { + MessageBox.Show(I18N.GetString("Unsupported operating system, use Windows Vista at least."), + "Shadowsocks Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + Utils.ReleaseMemory(true); using (Mutex mutex = new Mutex(false, "Global\\Shadowsocks_" + Application.StartupPath.GetHashCode())) { diff --git a/shadowsocks-csharp/Util/Util.cs b/shadowsocks-csharp/Util/Util.cs index 53077c87..9170c348 100755 --- a/shadowsocks-csharp/Util/Util.cs +++ b/shadowsocks-csharp/Util/Util.cs @@ -157,6 +157,10 @@ namespace Shadowsocks.Util return userKey; } + public static bool IsWinVistaOrHigher() { + return Environment.OSVersion.Version.Major > 5; + } + [DllImport("kernel32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool SetProcessWorkingSetSize(IntPtr process,