NetCon.Idl
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:26k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. //  File: netcon.idl
  7. //
  8. //----------------------------------------------------------------------------
  9. cpp_quote("//+-------------------------------------------------------------------------")
  10. cpp_quote("//")
  11. cpp_quote("//  Microsoft Windows")
  12. cpp_quote("//  Copyright (c) Microsoft Corporation. All rights reserved.")
  13. cpp_quote("//")
  14. cpp_quote("//--------------------------------------------------------------------------")
  15. cpp_quote("#if ( _MSC_VER >= 800 )")
  16. cpp_quote("#pragma warning(disable:4201)")
  17. cpp_quote("#endif")
  18. #ifndef DO_NO_IMPORTS
  19. import "oaidl.idl";
  20. import "unknwn.idl";
  21. import "wtypes.idl";
  22. import "prsht.idl";
  23. #endif
  24. cpp_quote("")
  25. cpp_quote("EXTERN_C const CLSID CLSID_ConnectionManager;")
  26. cpp_quote("EXTERN_C const CLSID CLSID_ConnectionCommonUi;")
  27. cpp_quote("EXTERN_C const CLSID CLSID_NetSharingManager;")
  28. cpp_quote("")
  29. cpp_quote("//These strings reference the HKEY_CURRENT_USER registry which")
  30. cpp_quote("//retains whether shortcuts are created on the desktop.")
  31. cpp_quote("#define NETCON_HKEYCURRENTUSERPATH      TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Network\\Network Connections")")
  32. cpp_quote("#define NETCON_DESKTOPSHORTCUT          TEXT("DesktopShortcut")")
  33. cpp_quote("#define NETCON_MAX_NAME_LEN 246")
  34. cpp_quote("")
  35. // Reserved GUIDS for our use
  36. //
  37. // C08956A0-1CD3-11D1-B1C5-00805FC1270E     IID_IEnumNetConnection
  38. // C08956A1-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnection
  39. // C08956A2-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionManager
  40. // C08956A3-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionConnectUi
  41. // C08956A4-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionPropertyUi
  42. // C08956A5-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionCommonUi
  43. // C08956A6-1CD3-11D1-B1C5-00805FC1270E     IID_INetLanConnectionUiInfo
  44. // ...
  45. // C08956B0-1CD3-11D1-B1C5-00805FC1270E     IID_IEnumNetSharingPortMapping
  46. // C08956B1-1CD3-11D1-B1C5-00805FC1270E     IID_INetSharingPortMapping
  47. // C08956B2-1CD3-11D1-B1C5-00805FC1270E     
  48. // C08956B3-1CD3-11D1-B1C5-00805FC1270E     
  49. // C08956B4-1CD3-11D1-B1C5-00805FC1270E     IID_IEnumNetSharingPublicConnection
  50. // C08956B5-1CD3-11D1-B1C5-00805FC1270E     IID_IEnumNetSharingPrivateConnection
  51. // C08956B6-1CD3-11D1-B1C5-00805FC1270E     IID_INetSharingConfiguration
  52. // C08956B7-1CD3-11D1-B1C5-00805FC1270E     IID_INetSharingManager
  53. // C08956B8-1CD3-11D1-B1C5-00805FC1270E     IID_IEnumNetSharingEveryConnection
  54. // C08956B9-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionPropertyUi2
  55. // C08956BA-1CD3-11D1-B1C5-00805FC1270E     IID_INetConnectionManagerEvents
  56. // ...
  57. // C08956FE-1CD3-11D1-B1C5-00805FC1270E
  58. // C08956FF-1CD3-11D1-B1C5-00805FC1270E
  59. // C0895700-1CD3-11D1-B1C5-00805FC1270E
  60. //
  61. interface IEnumNetConnection;
  62. interface INetConnection;
  63. interface INetConnectionManager;
  64. interface INetConnectionConnectUi;
  65. interface INetConnectionPropertyUi;
  66. interface INetConnectionPropertyUi2;
  67. interface INetConnectionCommonUi;
  68. interface INetLanConnectionUiInfo;
  69. interface INetConnectionManagerEvents;
  70. interface IEnumNetSharingPortMapping;
  71. interface INetSharingPortMapping;
  72. interface IEnumNetSharingPublicConnection;
  73. interface IEnumNetSharingPrivateConnection;
  74. interface IEnumNetSharingEveryConnection;
  75. interface INetSharingConfiguration;
  76. interface INetSharingManager;
  77. //+---------------------------------------------------------------------------
  78. // IEnumNetConnection - An enumerator for INetConnection objects.
  79. //
  80. [
  81.     object,
  82.     uuid(C08956A0-1CD3-11D1-B1C5-00805FC1270E),
  83.     pointer_default(unique)
  84. ]
  85. interface IEnumNetConnection : IUnknown
  86. {
  87.     HRESULT Next(
  88.         [in] ULONG celt,
  89.         [out, size_is(celt), length_is(*pceltFetched)]
  90.         INetConnection** rgelt,
  91.         [out] ULONG* pceltFetched);
  92.     HRESULT Skip(
  93.         [in] ULONG celt);
  94.     HRESULT Reset();
  95.     HRESULT Clone(
  96.         [out] IEnumNetConnection** ppenum);
  97. };
  98. //+---------------------------------------------------------------------------
  99. // INetConnection -
  100. //
  101. [
  102.     object,
  103.     uuid(C08956A1-1CD3-11D1-B1C5-00805FC1270E),
  104.     pointer_default(unique)
  105. ]
  106. interface INetConnection : IUnknown
  107. {
  108.     typedef enum tagNETCON_CHARACTERISTIC_FLAGS
  109.     {
  110.         NCCF_NONE               = 0x0000,   // No special characteristics
  111.         NCCF_ALL_USERS          = 0x0001,   // Connection is available to all users
  112.         NCCF_ALLOW_DUPLICATION  = 0x0002,   // Connection is duplicable
  113.         NCCF_ALLOW_REMOVAL      = 0x0004,   // Connection is removable
  114.         NCCF_ALLOW_RENAME       = 0x0008,   // Connection can be renamed
  115.         NCCF_SHOW_ICON          = 0x0010,   // Shows icon in taskbar when connected
  116.         NCCF_INCOMING_ONLY      = 0x0020,   // Direction is "incoming" only
  117.         NCCF_OUTGOING_ONLY      = 0x0040,   // Direction is "outgoing" only
  118.         NCCF_BRANDED            = 0x0080,   // Icons are branded
  119.         NCCF_SHARED             = 0x0100,   // Connection is shared
  120.         NCCF_BRIDGED            = 0x0200,   // Connection is bridged
  121.         NCCF_FIREWALLED         = 0x0400,   // Connection is firewalled
  122.         NCCF_DEFAULT            = 0x0800,   // This is the default connection
  123.     } NETCON_CHARACTERISTIC_FLAGS;
  124.     typedef enum tagNETCON_STATUS
  125.     {
  126.         NCS_DISCONNECTED,
  127.         NCS_CONNECTING,
  128.         NCS_CONNECTED,
  129.         NCS_DISCONNECTING,
  130.         NCS_HARDWARE_NOT_PRESENT,
  131.         NCS_HARDWARE_DISABLED,
  132.         NCS_HARDWARE_MALFUNCTION,
  133.         NCS_MEDIA_DISCONNECTED,
  134.         NCS_AUTHENTICATING,
  135.         NCS_AUTHENTICATION_SUCCEEDED,
  136.         NCS_AUTHENTICATION_FAILED,
  137.         NCS_INVALID_ADDRESS,
  138.         NCS_CREDENTIALS_REQUIRED
  139.     } NETCON_STATUS;
  140.     typedef enum tagNETCON_TYPE
  141.     {
  142.         NCT_DIRECT_CONNECT,
  143.         NCT_INBOUND,
  144.         NCT_INTERNET,
  145.         NCT_LAN,
  146.         NCT_PHONE,
  147.         NCT_TUNNEL,
  148.         NCT_BRIDGE,
  149.     } NETCON_TYPE;
  150.     typedef enum tagNETCON_MEDIATYPE
  151.     {
  152.         NCM_NONE,
  153.         NCM_DIRECT,
  154.         NCM_ISDN,
  155.         NCM_LAN,
  156.         NCM_PHONE,
  157.         NCM_TUNNEL,
  158.         NCM_PPPOE,
  159.         NCM_BRIDGE,
  160.         NCM_SHAREDACCESSHOST_LAN,
  161.         NCM_SHAREDACCESSHOST_RAS,
  162.     } NETCON_MEDIATYPE;
  163.     typedef struct tagNETCON_PROPERTIES
  164.     {
  165.                  GUID               guidId;
  166.         [string] LPWSTR             pszwName;
  167.         [string] LPWSTR             pszwDeviceName;
  168.                  NETCON_STATUS      Status;
  169.                  NETCON_MEDIATYPE   MediaType;
  170.                  DWORD              dwCharacter;
  171.                  CLSID              clsidThisObject;
  172.                  CLSID              clsidUiObject;
  173.     } NETCON_PROPERTIES;
  174.     HRESULT Connect();
  175. cpp_quote("#define S_OBJECT_NO_LONGER_VALID ((HRESULT)0x00000002L)")
  176.     // Disconnect can return S_OBJECT_NO_LONGER_VALID which indicates
  177.     // success, but that the object is no longer valid.  Clients, when
  178.     // getting this error message, should simply release the interface.
  179.     //
  180.     HRESULT Disconnect();
  181.     HRESULT Delete();
  182.     HRESULT Duplicate(
  183.         [in, string] LPCWSTR    pszwDuplicateName,
  184.         [out] INetConnection**  ppCon);
  185.     HRESULT GetProperties(
  186.         [out] NETCON_PROPERTIES** ppProps);
  187.     HRESULT GetUiObjectClassId(
  188.         [out, ref] CLSID* pclsid);
  189.     HRESULT Rename(
  190.         [in, string] LPCWSTR pszwNewName);
  191. };
  192. cpp_quote("")
  193. cpp_quote("STDAPI_(VOID) NcFreeNetconProperties (NETCON_PROPERTIES* pProps);")
  194. cpp_quote("")
  195. cpp_quote("")
  196. cpp_quote("STDAPI_(BOOL) NcIsValidConnectionName (PCWSTR pszwName);")
  197. cpp_quote("")
  198. //+---------------------------------------------------------------------------
  199. // INetConnectionManager - The top-level object that contains all of the
  200. //      INetConnection objects on a machine.
  201. //
  202. // This interface manages INetConnection objects.  It provides methods
  203. // to:
  204. //     - Enumerate INetConnections
  205. //     - Remove an INetConnection
  206. //     - Find an INetConnection
  207. //
  208. // Note: Adding a connection is not yet performed programatically through
  209. // the connection manager.  Instead, the shell owns creating connection
  210. // objects through a UI interface.
  211. //
  212. [
  213.     object,
  214.     uuid(C08956A2-1CD3-11D1-B1C5-00805FC1270E),
  215.     pointer_default(unique)
  216. ]
  217. interface INetConnectionManager : IUnknown
  218. {
  219.     typedef enum tagNETCONMGR_ENUM_FLAGS
  220.     {
  221.         NCME_DEFAULT = 0x0,
  222.     } NETCONMGR_ENUM_FLAGS;
  223.     // Return an IEnumNetConnection interface used to enumerate all of
  224.     // the contained connection objects.
  225.     //
  226.     HRESULT EnumConnections(
  227.         [in] NETCONMGR_ENUM_FLAGS   Flags,
  228.         [out] IEnumNetConnection**  ppEnum);
  229. };
  230. //+---------------------------------------------------------------------------
  231. // INetConnectionManagerEvents -
  232. //
  233. [
  234.     object,
  235.     uuid(C08956BA-1CD3-11D1-B1C5-00805FC1270E),
  236.     pointer_default(unique)
  237. ]
  238. interface INetConnectionManagerEvents : IUnknown
  239. {
  240.     HRESULT RefreshConnections();
  241.     HRESULT Enable();
  242.     HRESULT Disable(
  243.         [in] ULONG ulDisableTimeout);
  244. };
  245. //+---------------------------------------------------------------------------
  246. // INetConnectionConnectUi -
  247. //
  248. [
  249.     local,
  250.     object,
  251.     uuid(C08956A3-1CD3-11D1-B1C5-00805FC1270E),
  252.     pointer_default(unique)
  253. ]
  254. interface INetConnectionConnectUi : IUnknown
  255. {
  256.     typedef enum tagNETCONUI_CONNECT_FLAGS
  257.     {
  258.         NCUC_DEFAULT    = 0x0000,
  259.         NCUC_NO_UI      = 0x0001,
  260.     } NETCONUI_CONNECT_FLAGS;
  261.     HRESULT SetConnection(
  262.         [in] INetConnection* pCon);
  263.     HRESULT Connect (
  264.         [in] HWND hwndParent,
  265.         [in] DWORD dwFlags);
  266.     HRESULT Disconnect (
  267.         [in] HWND hwndParent,
  268.         [in] DWORD dwFlags);
  269. };
  270. //+---------------------------------------------------------------------------
  271. // INetConnectionPropertyUi -
  272. //
  273. [
  274.     local,
  275.     object,
  276.     uuid(C08956A4-1CD3-11D1-B1C5-00805FC1270E),
  277.     pointer_default(unique)
  278. ]
  279. interface INetConnectionPropertyUi : IUnknown
  280. {
  281.     HRESULT SetConnection(
  282.         [in] INetConnection* pCon);
  283.     HRESULT AddPages (
  284.         [in] HWND hwndParent,
  285.         [in] LPFNADDPROPSHEETPAGE pfnAddPage,
  286.         [in] LPARAM lParam);
  287. };
  288. //+---------------------------------------------------------------------------
  289. // INetConnectionPropertyUi2 -
  290. //
  291.     local,
  292.     object,
  293.     uuid(C08956B9-1CD3-11D1-B1C5-00805FC1270E),
  294.     pointer_default(unique)
  295. ]
  296. interface INetConnectionPropertyUi2 : INetConnectionPropertyUi
  297. {
  298.     HRESULT GetIcon(
  299.         [in]  DWORD dwSize,
  300.         [out] HICON *phIcon);
  301. };
  302. //+---------------------------------------------------------------------------
  303. // INetConnectionCommonUi -
  304. //
  305. [
  306.     local,
  307.     object,
  308.     uuid(C08956A5-1CD3-11D1-B1C5-00805FC1270E),
  309.     pointer_default(unique)
  310. ]
  311. interface INetConnectionCommonUi : IUnknown
  312. {
  313.     typedef enum tagNETCON_CHOOSEFLAGS
  314.     {
  315.         NCCHF_CONNECT    = 0x0001,      // Selected Connection is activated
  316.                                         // and returned. If not set then
  317.                                         // the selected connection interface
  318.                                         // is returned without being activated
  319.         NCCHF_CAPTION    = 0x0002,
  320.         NCCHF_OKBTTNTEXT = 0x0004,
  321.         NCCHF_DISABLENEW = 0x0008,
  322.         NCCHF_AUTOSELECT = 0x0010,      // Automatically Choose or Connect,
  323.                                         // based upon NCCHF_CONNECT if only
  324.                                         // one connection matches the
  325.                                         // dwTypeMask.
  326.     } NETCON_CHOOSEFLAGS;
  327.     typedef enum tagNETCON_CHOOSETYPE
  328.     {
  329.         NCCHT_DIRECT_CONNECT = 0x0001,
  330.         NCCHT_LAN            = 0x0002,
  331.         NCCHT_PHONE          = 0x0004,
  332.         NCCHT_TUNNEL         = 0x0008,
  333.         NCCHT_ISDN           = 0x0010,
  334.         NCCHT_ALL            = 0x001F
  335.     } NETCON_CHOOSETYPE;
  336.     typedef struct tagNETCON_CHOOSECONN
  337.     {
  338.         DWORD       lStructSize;
  339.         HWND        hwndParent;
  340.         DWORD       dwFlags;            // Combine NCCHF_* flags
  341.         DWORD       dwTypeMask;         // Combine NCCHT_* flags
  342.         LPCWSTR     lpstrCaption;
  343.         LPCWSTR     lpstrOkBttnText;
  344.     } NETCON_CHOOSECONN;
  345.     HRESULT ChooseConnection(
  346.         [in] NETCON_CHOOSECONN * pChooseConn,
  347.         [out] INetConnection** ppCon);
  348.     HRESULT ShowConnectionProperties (
  349.         [in] HWND hwndParent,
  350.         [in] INetConnection* pCon);
  351.     HRESULT StartNewConnectionWizard (
  352.         [in] HWND hwndParent,
  353.         [out] INetConnection** ppCon);
  354. };
  355. //+---------------------------------------------------------------------------
  356. // IEnumNetSharingPortMapping - An enumerator for INetSharingPortMapping objects.
  357. //
  358. [
  359.     object,
  360.     uuid(C08956B0-1CD3-11D1-B1C5-00805FC1270E),
  361.     pointer_default(unique)
  362. ]
  363. interface IEnumNetSharingPortMapping : IUnknown
  364. {
  365.     HRESULT Next(
  366.         [in] ULONG celt,
  367.         [out, size_is(celt), length_is(*pceltFetched)]
  368.         VARIANT * rgVar,
  369.         [out] ULONG* pceltFetched);
  370.     HRESULT Skip(
  371.         [in] ULONG celt);
  372.     HRESULT Reset();
  373.     HRESULT Clone(
  374.         [out] IEnumNetSharingPortMapping** ppenum);
  375. };
  376. [
  377.     object,
  378.     uuid(24B7E9B5-E38F-4685-851B-00892CF5F940),
  379.     oleautomation, dual,
  380.     pointer_default(unique)
  381. ]
  382. interface INetSharingPortMappingProps : IDispatch
  383. {
  384.     [propget, id(1), helpstring("property Name")]            HRESULT Name           ([out, retval] BSTR  * pbstrName);
  385.     [propget, id(2), helpstring("property IPProtocol")]      HRESULT IPProtocol     ([out, retval] UCHAR * pucIPProt);
  386.     [propget, id(3), helpstring("property ExternalPort")]    HRESULT ExternalPort   ([out, retval] long  * pusPort);
  387.     [propget, id(4), helpstring("property InternalPort")]    HRESULT InternalPort   ([out, retval] long  * pusPort);
  388.     [propget, id(5), helpstring("property Options")]         HRESULT Options        ([out, retval] long  * pdwOptions);
  389.     [propget, id(6), helpstring("property TargetName")]      HRESULT TargetName     ([out, retval] BSTR  * pbstrTargetName);
  390.     [propget, id(7), helpstring("property TargetIPAddress")] HRESULT TargetIPAddress([out, retval] BSTR  * pbstrTargetIPAddress);
  391.     [propget, id(8), helpstring("property Enabled")]         HRESULT Enabled        ([out, retval] VARIANT_BOOL * pbool);
  392. };
  393. //+---------------------------------------------------------------------------
  394. // INetSharingPortMapping -
  395. //
  396. [
  397.     object,
  398.     uuid(C08956B1-1CD3-11D1-B1C5-00805FC1270E),
  399.     oleautomation, dual,
  400.     pointer_default(unique)
  401. ]
  402. interface INetSharingPortMapping : IDispatch
  403. {
  404.     [id(1), helpstring("method Disable")]
  405. HRESULT Disable();
  406.     [id(2), helpstring("method Enable")]
  407. HRESULT Enable();
  408.     [propget, id(3), helpstring("property Properties")]
  409.     HRESULT Properties(
  410.         [out, retval] INetSharingPortMappingProps ** ppNSPMP);
  411.     [id(4), helpstring("method Delete")]
  412. HRESULT Delete();
  413. };
  414. //+---------------------------------------------------------------------------
  415. // IEnumNetSharingEveryConnection - An enumerator for INetConnection interface pointers
  416. //                          that represent all connections in the connections folder
  417. //
  418. [
  419.     object,
  420.     uuid(C08956B8-1CD3-11D1-B1C5-00805FC1270E),
  421.     pointer_default(unique)
  422. ]
  423. interface IEnumNetSharingEveryConnection : IUnknown
  424. {
  425.     HRESULT Next(
  426.         [in] ULONG celt,
  427.         [out, size_is(celt), length_is(*pceltFetched)]
  428.         VARIANT * rgVar,
  429.         [out] ULONG* pceltFetched);
  430.     HRESULT Skip(
  431.         [in] ULONG celt);
  432.     HRESULT Reset();
  433.     HRESULT Clone(
  434.         [out] IEnumNetSharingEveryConnection** ppenum);
  435. };
  436. //+---------------------------------------------------------------------------
  437. // IEnumNetSharingPublicConnection - An enumerator for INetConnection interface pointers
  438. //                         that represent connections configured as publicly shared.
  439. //
  440. [
  441.     object,
  442.     uuid(C08956B4-1CD3-11D1-B1C5-00805FC1270E),
  443.     pointer_default(unique)
  444. ]
  445. interface IEnumNetSharingPublicConnection : IUnknown
  446. {
  447.     HRESULT Next(
  448.         [in] ULONG celt,
  449.         [out, size_is(celt), length_is(*pceltFetched)]
  450.         VARIANT * rgVar,
  451.         [out] ULONG* pceltFetched);
  452.     HRESULT Skip(
  453.         [in] ULONG celt);
  454.     HRESULT Reset();
  455.     HRESULT Clone(
  456.         [out] IEnumNetSharingPublicConnection** ppenum);
  457. };
  458. //+---------------------------------------------------------------------------
  459. // IEnumNetSharingPrivateConnection - An enumerator for INetConnection interface pointers
  460. //                         that represent connections configured as privately shared.
  461. //
  462. [
  463.     object,
  464.     uuid(C08956B5-1CD3-11D1-B1C5-00805FC1270E),
  465.     pointer_default(unique)
  466. ]
  467. interface IEnumNetSharingPrivateConnection : IUnknown
  468. {
  469.     HRESULT Next(
  470.         [in] ULONG celt,
  471.         [out, size_is(celt), length_is(*pCeltFetched)] VARIANT * rgVar,
  472.         [out] ULONG * pCeltFetched);
  473.     HRESULT Skip(
  474.         [in] ULONG celt);
  475.     HRESULT Reset();
  476.     HRESULT Clone(
  477.         [out] IEnumNetSharingPrivateConnection** ppenum);
  478. };
  479. // Collection needed for INetSharingConfiguration::EnumPortMappings() below
  480. [
  481. object,
  482.     uuid(02E4A2DE-DA20-4E34-89C8-AC22275A010B),
  483.     oleautomation, dual,
  484. helpstring("INetSharingPortMappingCollection Interface"),
  485. pointer_default(unique)
  486. ]
  487. interface INetSharingPortMappingCollection : IDispatch
  488. {
  489. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum:  gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  490. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  491. };
  492. cpp_quote("// properties for INetConnection (wraps NETCON_PROPERTIES)")
  493. [
  494. object,
  495.     uuid(F4277C95-CE5B-463D-8167-5662D9BCAA72),
  496.     oleautomation, dual,
  497. helpstring("INetConnectionProps Interface"),
  498. pointer_default(unique)
  499. ]
  500. interface INetConnectionProps : IDispatch
  501. {
  502.     [propget, id(1), helpstring("property Guid")]
  503. HRESULT Guid ([out, retval] BSTR * pbstrGuid);
  504.     [propget, id(2), helpstring("property Name")]
  505. HRESULT Name ([out, retval] BSTR * pbstrName);
  506.     [propget, id(3), helpstring("property DeviceName")]
  507. HRESULT DeviceName ([out, retval] BSTR * pbstrDeviceName);
  508.     [propget, id(4), helpstring("property Status")]
  509. HRESULT Status ([out, retval] NETCON_STATUS * pStatus);
  510.     [propget, id(5), helpstring("property MediaType")]
  511. HRESULT MediaType ([out, retval] NETCON_MEDIATYPE * pMediaType);
  512.     [propget, id(6), helpstring("property Characteristics")]
  513. HRESULT Characteristics ([out, retval] DWORD * pdwFlags);
  514. };
  515. //+---------------------------------------------------------------------------
  516. // INetSharingConfiguration - the connection level object that
  517. //
  518. // It provides methods to:
  519. //     - Enable/Disable Internet Connection Sharing
  520. //     - Enable/Disable Internet Connection Protection
  521. //     - Enumerate Port Mappings
  522. //     - Add Port Mappings
  523. //
  524. [
  525.     object,
  526.     uuid(C08956B6-1CD3-11D1-B1C5-00805FC1270E),
  527.     oleautomation, dual,
  528.     pointer_default(unique)
  529. ]
  530. interface INetSharingConfiguration : IDispatch
  531. {
  532. typedef enum tagSHARINGCONNECTIONTYPE
  533. {
  534. ICSSHARINGTYPE_PUBLIC = 0x0,
  535. ICSSHARINGTYPE_PRIVATE
  536. SHARINGCONNECTIONTYPE, *LPSHARINGCONNECTIONTYPE;
  537.     typedef enum tagSHARINGCONNECTION_ENUM_FLAGS
  538.     {
  539.             ICSSC_DEFAULT = 0x0,
  540.             ICSSC_ENABLED
  541.     }
  542.     SHARINGCONNECTION_ENUM_FLAGS;
  543.     typedef enum tagICS_TARGETTYPE
  544.     {
  545.             ICSTT_NAME = 0x0,
  546.             ICSTT_IPADDRESS
  547.     }
  548.     ICS_TARGETTYPE;
  549.     [propget, id(1), helpstring("property SharingEnabled")]
  550. HRESULT SharingEnabled([out, retval] VARIANT_BOOL* pbEnabled);
  551.     [propget, id(2), helpstring("property SharingConnectionType")]
  552. HRESULT SharingConnectionType([out, retval] SHARINGCONNECTIONTYPE* pType);
  553.     [id(3), helpstring("method DisableSharing")]
  554. HRESULT DisableSharing();
  555.     [id(4), helpstring("method EnableSharing")]
  556. HRESULT EnableSharing([in]  SHARINGCONNECTIONTYPE  Type );
  557.     [propget, id(5), helpstring("property InternetFirewallEnabled")]
  558. HRESULT InternetFirewallEnabled([out, retval] VARIANT_BOOL *pbEnabled );
  559.     [id(6), helpstring("method DisableInternetFirewall")]
  560. HRESULT DisableInternetFirewall();
  561.     [id(7), helpstring("method EnableInternetFirewall")]
  562. HRESULT EnableInternetFirewall();
  563.     // Return an IEnumNetSharingPortMapping interface used to enumerate all of
  564.     // the contained INetSharingPortMapping objects.
  565.     //
  566.     [propget, id(8), helpstring("EnumPortMappings")]
  567.     HRESULT EnumPortMappings(
  568.         [in]  SHARINGCONNECTION_ENUM_FLAGS Flags,
  569.         [out, retval] INetSharingPortMappingCollection** ppColl);
  570.     [id(9), helpstring("method AddPortMapping")]
  571. HRESULT AddPortMapping(
  572. [in]  BSTR     bstrName,
  573. [in]  UCHAR    ucIPProtocol,
  574. [in]  USHORT   usExternalPort,
  575. [in]  USHORT   usInternalPort,
  576.     [in]  DWORD    dwOptions,
  577. [in]  BSTR     bstrTargetNameOrIPAddress,
  578.         [in]  ICS_TARGETTYPE eTargetType,
  579. [out, retval] INetSharingPortMapping** ppMapping );
  580.     [id(10), helpstring("method RemovePortMapping")]
  581. HRESULT RemovePortMapping([in]  INetSharingPortMapping*  pMapping );
  582. };
  583. // ICollection interfaces
  584. [
  585. object,
  586.         uuid(33C4643C-7811-46FA-A89A-768597BD7223),
  587.         oleautomation, dual,
  588. helpstring("INetSharingEveryConnectionCollection Interface"),
  589. pointer_default(unique)
  590. ]
  591. interface INetSharingEveryConnectionCollection : IDispatch
  592. {
  593. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum:  gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  594. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  595. };
  596. [
  597. object,
  598.         uuid(7D7A6355-F372-4971-A149-BFC927BE762A),
  599.         oleautomation, dual,
  600. helpstring("INetSharingPublicConnectionCollection Interface"),
  601. pointer_default(unique)
  602. ]
  603. interface INetSharingPublicConnectionCollection : IDispatch
  604. {
  605. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum:  gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  606. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  607. };
  608. [
  609. object,
  610.         uuid(38AE69E0-4409-402A-A2CB-E965C727F840),
  611.         oleautomation, dual,
  612. helpstring("INetSharingPrivateConnectionCollection Interface"),
  613. pointer_default(unique)
  614. ]
  615. interface INetSharingPrivateConnectionCollection : IDispatch
  616. {
  617. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum:  gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  618. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  619. };
  620. //+---------------------------------------------------------------------------
  621. // INetSharingManager - the top level object that
  622. //
  623. // It provides methods to:
  624. //     - Determine whether Internet Connection Sharing is installed
  625. //     - Enumerate Public Connections
  626. //     - Enumerate Private Connections
  627. //
  628. [
  629.     object,
  630.     uuid(C08956B7-1CD3-11D1-B1C5-00805FC1270E),
  631.     oleautomation, dual,
  632.     pointer_default(unique)
  633. ]
  634. interface INetSharingManager : IDispatch
  635. {
  636.     [propget, id(1), helpstring("property SharingInstalled")]
  637. HRESULT SharingInstalled([out, retval] VARIANT_BOOL *pbInstalled );
  638.     // Return an IEnumNetSharingPublicConnection interface used to enumerate all of
  639.     // the contained INetConnections configured as a public adapter
  640.     //
  641.     [propget, id(2), helpstring("EnumPublicConnections")]
  642.     HRESULT EnumPublicConnections(
  643.         [in]  SHARINGCONNECTION_ENUM_FLAGS Flags,
  644.         [out, retval] INetSharingPublicConnectionCollection ** ppColl);
  645.     // Return an IEnumNetSharingPrivateConnection interface used to enumerate all of
  646.     // the contained INetConnections configured as a private adapter
  647.     //
  648.     [propget, id(3), helpstring("EnumPrivateConnections")]
  649.     HRESULT EnumPrivateConnections(
  650.         [in]  SHARINGCONNECTION_ENUM_FLAGS Flags,
  651.         [out, retval] INetSharingPrivateConnectionCollection ** ppColl);
  652.     [propget, id(6), helpstring("INetSharingConfigurationForINetConnection")]
  653.     HRESULT INetSharingConfigurationForINetConnection(
  654.         [in] INetConnection *pNetConnection,
  655.         [out, retval] INetSharingConfiguration **ppNetSharingConfiguration
  656.         );
  657.     // Return an IEnumNetSharingEveryConnection interface used to enumerate all of
  658.     // the contained INetConnections configured as a public adapter
  659.     //
  660.     [propget, id(7), helpstring("EnumEveryConnection")]
  661.     HRESULT EnumEveryConnection([out, retval] INetSharingEveryConnectionCollection ** ppColl);
  662.     // get properties interface for any INetConnection
  663.     [propget, id(8), helpstring("NetConnectionProps")]
  664.     HRESULT NetConnectionProps(
  665.         [in] INetConnection *pNetConnection,
  666.         [out, retval] INetConnectionProps ** ppProps);
  667. };
  668. //
  669. // AlgSetup.idl : IDL source for AlgSetup.dll
  670. //
  671. // To allow third party to Install/Remove ALG PlugIns
  672. //
  673.      const int ALG_SETUP_PORTS_LIST_BYTE_SIZE=2048;
  674. [
  675. object,
  676. uuid(A779AF1A-009A-4C44-B9F0-8F0F4CF2AE49),
  677. dual,
  678. helpstring("IAlgSetup Interface"),
  679. pointer_default(unique)
  680. ]
  681. interface IAlgSetup : IDispatch
  682. {
  683. [id(1), helpstring("method Add")] 
  684. HRESULT Add(
  685. [in] BSTR  pszProgID, 
  686. [in] BSTR  pszPublisher, 
  687. [in] BSTR  pszProduct, 
  688. [in] BSTR  pszVersion, 
  689.                [in] short nProtocol,
  690. [in] BSTR  pszPorts
  691. );
  692. [id(2), helpstring("method Remove")] 
  693. HRESULT Remove(
  694. [in] BSTR pszProgID
  695. );
  696. };
  697. [
  698. uuid(43E734CA-043D-4A70-9A2C-A8F254063D91),
  699. version(1.0),
  700. helpstring("NetCon 1.0 Type Library")
  701. ]
  702. library NETCONLib
  703. {
  704.     importlib("stdole2.tlb");
  705.     [
  706.         uuid(5C63C1AD-3956-4FF8-8486-40034758315B),
  707.         helpstring("NetSharingManager Class")
  708.     ]
  709.     coclass NetSharingManager
  710.     {
  711.         [default] interface INetSharingManager;
  712.     };
  713.     
  714.     
  715.     
  716.     
  717.     [   
  718.         uuid(27D0BCCC-344D-4287-AF37-0C72C161C14C),
  719.         helpstring("AlgSetup Class")
  720.     ]
  721.     coclass AlgSetup
  722.     {
  723.         [default] interface IAlgSetup;
  724.     };
  725.     
  726.     
  727. };