- Running on Windows Vista or above Signed-off-by: Syrone Wong <wong.syrone@gmail.com>tags/3.3
@@ -113,5 +113,6 @@ Failed to update registry=无法修改注册表 | |||||
System Proxy On: =系统代理已启用: | System Proxy On: =系统代理已启用: | ||||
Running: Port {0}=正在运行:端口 {0} | Running: Port {0}=正在运行:端口 {0} | ||||
Unexpected error, shadowsocks will exit. Please report to=非预期错误,Shadowsocks将退出。请提交此错误到 | Unexpected error, shadowsocks will exit. Please report to=非预期错误,Shadowsocks将退出。请提交此错误到 | ||||
Unsupported operating system, use Windows Vista at least.=不支持的操作系统版本,最低需求为Windows Vista。 | |||||
Proxy request failed=代理请求失败 | Proxy request failed=代理请求失败 | ||||
Proxy handshake failed=代理握手失败 | Proxy handshake failed=代理握手失败 |
@@ -18,6 +18,14 @@ namespace Shadowsocks | |||||
[STAThread] | [STAThread] | ||||
static void Main() | 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); | Utils.ReleaseMemory(true); | ||||
using (Mutex mutex = new Mutex(false, "Global\\Shadowsocks_" + Application.StartupPath.GetHashCode())) | using (Mutex mutex = new Mutex(false, "Global\\Shadowsocks_" + Application.StartupPath.GetHashCode())) | ||||
{ | { | ||||
@@ -157,6 +157,10 @@ namespace Shadowsocks.Util | |||||
return userKey; | return userKey; | ||||
} | } | ||||
public static bool IsWinVistaOrHigher() { | |||||
return Environment.OSVersion.Version.Major > 5; | |||||
} | |||||
[DllImport("kernel32.dll")] | [DllImport("kernel32.dll")] | ||||
[return: MarshalAs(UnmanagedType.Bool)] | [return: MarshalAs(UnmanagedType.Bool)] | ||||
private static extern bool SetProcessWorkingSetSize(IntPtr process, | private static extern bool SetProcessWorkingSetSize(IntPtr process, | ||||