From b310cfeda2b96ce4dc5f7e52a1fc0c2301e0ec3a Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 16 Dec 2019 20:04:58 +0800 Subject: [PATCH] Update ProxySetting.cs --- v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs b/v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs index 9dcc9cbd4c3..6dcac6c367b 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs @@ -70,14 +70,22 @@ public static bool SetProxy(string strProxy, string exceptions, int type) // copy the array over into that spot in memory ... for (int i = 0; i < options.Length; ++i) { - IntPtr opt = new IntPtr(optionsPtr.ToInt32() + (i * optSize)); - Marshal.StructureToPtr(options[i], opt, false); + if (Environment.Is64BitOperatingSystem) + { + IntPtr opt = new IntPtr(optionsPtr.ToInt64() + (i * optSize)); + Marshal.StructureToPtr(options[i], opt, false); + } + else + { + IntPtr opt = new IntPtr(optionsPtr.ToInt32() + (i * optSize)); + Marshal.StructureToPtr(options[i], opt, false); + } } - list.options = optionsPtr; + list.options = optionsPtr;i // and then make a pointer out of the whole list - IntPtr ipcoListPtr = Marshal.AllocCoTaskMem((Int32)list.dwSize); + IntPtr ipcoListPtr = Marshal.AllocCoTaskMem((int)list.dwSize); Marshal.StructureToPtr(list, ipcoListPtr, false); // and finally, call the API method!