You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

INTERNET_PER_CONN_OPTION.cs 4.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /****************************** Module Header ******************************\
  2. Module Name: INTERNET_PER_CONN_OPTION.cs
  3. Project: CSWebBrowserWithProxy
  4. Copyright (c) Microsoft Corporation.
  5. This file defines the struct INTERNET_PER_CONN_OPTION and constants used by it.
  6. The struct INTERNET_PER_CONN_OPTION contains the value of an option that to be
  7. set to internet settings.
  8. Visit http://msdn.microsoft.com/en-us/library/aa385145(VS.85).aspx to get the
  9. detailed description.
  10. This source is subject to the Microsoft Public License.
  11. See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
  12. All other rights reserved.
  13. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
  14. EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
  15. WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  16. \***************************************************************************/
  17. using System;
  18. using System.Runtime.InteropServices;
  19. namespace Shadowsocks.Util.SystemProxy
  20. {
  21. /// <summary>
  22. /// Constants used in INTERNET_PER_CONN_OPTION_OptionUnion struct.
  23. /// </summary>
  24. public enum INTERNET_PER_CONN_OptionEnum
  25. {
  26. INTERNET_PER_CONN_FLAGS = 1,
  27. INTERNET_PER_CONN_PROXY_SERVER = 2,
  28. INTERNET_PER_CONN_PROXY_BYPASS = 3,
  29. INTERNET_PER_CONN_AUTOCONFIG_URL = 4,
  30. INTERNET_PER_CONN_AUTODISCOVERY_FLAGS = 5,
  31. INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL = 6,
  32. INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS = 7,
  33. INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME = 8,
  34. INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL = 9,
  35. INTERNET_PER_CONN_FLAGS_UI = 10
  36. }
  37. /// <summary>
  38. /// Constants used in INTERNET_PER_CONN_OPTON struct.
  39. /// </summary>
  40. [Flags]
  41. public enum INTERNET_OPTION_PER_CONN_FLAGS
  42. {
  43. PROXY_TYPE_DIRECT = 0x00000001, // direct to net
  44. PROXY_TYPE_PROXY = 0x00000002, // via named proxy
  45. PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy URL
  46. PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
  47. }
  48. /// <summary>
  49. /// Constants used in INTERNET_PER_CONN_OPTON struct.
  50. /// Windows 7 and later:
  51. /// Clients that support Internet Explorer 8 should query the connection type using INTERNET_PER_CONN_FLAGS_UI.
  52. /// If this query fails, then the system is running a previous version of Internet Explorer and the client should
  53. /// query again with INTERNET_PER_CONN_FLAGS.
  54. /// Restore the connection type using INTERNET_PER_CONN_FLAGS regardless of the version of Internet Explorer.
  55. /// XXX: If fails, notify user to upgrade Internet Explorer
  56. /// </summary>
  57. [Flags]
  58. public enum INTERNET_OPTION_PER_CONN_FLAGS_UI
  59. {
  60. PROXY_TYPE_DIRECT = 0x00000001, // direct to net
  61. PROXY_TYPE_PROXY = 0x00000002, // via named proxy
  62. PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy URL
  63. PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
  64. }
  65. /// <summary>
  66. /// Used in INTERNET_PER_CONN_OPTION.
  67. /// When create a instance of OptionUnion, only one filed will be used.
  68. /// The StructLayout and FieldOffset attributes could help to decrease the struct size.
  69. /// </summary>
  70. [StructLayout(LayoutKind.Explicit)]
  71. public struct INTERNET_PER_CONN_OPTION_OptionUnion
  72. {
  73. // A value in INTERNET_OPTION_PER_CONN_FLAGS.
  74. [FieldOffset(0)]
  75. public int dwValue;
  76. [FieldOffset(0)]
  77. public System.IntPtr pszValue;
  78. [FieldOffset(0)]
  79. public System.Runtime.InteropServices.ComTypes.FILETIME ftValue;
  80. }
  81. [StructLayout(LayoutKind.Sequential)]
  82. public struct INTERNET_PER_CONN_OPTION
  83. {
  84. // A value in INTERNET_PER_CONN_OptionEnum.
  85. public int dwOption;
  86. public INTERNET_PER_CONN_OPTION_OptionUnion Value;
  87. }
  88. }