Skip to content

Commit

Permalink
Update ProxySetting.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust authored Dec 16, 2019
1 parent 07cd855 commit b310cfe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions v2rayN/v2rayN/HttpProxyHandler/ProxySetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit b310cfe

Please sign in to comment.