NetCon.Idl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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. NCCF_HOMENET_CAPABLE = 0x1000, // The device supports home networking
  124. NCCF_SHARED_PRIVATE = 0x2000, // The connection is private (part of ICS)
  125. NCCF_QUARANTINED = 0x4000, // Connection is quarantined
  126. NCCF_RESERVED = 0x8000, // Unused
  127. NCCF_BLUETOOTH_MASK = 0x000F0000, // Bluetooth Characteristics
  128. NCCF_LAN_MASK = 0x00F00000 // LAN Characteristics
  129. } NETCON_CHARACTERISTIC_FLAGS;
  130. typedef enum tagNETCON_STATUS
  131. {
  132. NCS_DISCONNECTED,
  133. NCS_CONNECTING,
  134. NCS_CONNECTED,
  135. NCS_DISCONNECTING,
  136. NCS_HARDWARE_NOT_PRESENT,
  137. NCS_HARDWARE_DISABLED,
  138. NCS_HARDWARE_MALFUNCTION,
  139. NCS_MEDIA_DISCONNECTED,
  140. NCS_AUTHENTICATING,
  141. NCS_AUTHENTICATION_SUCCEEDED,
  142. NCS_AUTHENTICATION_FAILED,
  143. NCS_INVALID_ADDRESS,
  144. NCS_CREDENTIALS_REQUIRED
  145. } NETCON_STATUS;
  146. typedef enum tagNETCON_TYPE
  147. {
  148. NCT_DIRECT_CONNECT,
  149. NCT_INBOUND,
  150. NCT_INTERNET,
  151. NCT_LAN,
  152. NCT_PHONE,
  153. NCT_TUNNEL,
  154. NCT_BRIDGE,
  155. } NETCON_TYPE;
  156. typedef enum tagNETCON_MEDIATYPE
  157. {
  158. NCM_NONE,
  159. NCM_DIRECT,
  160. NCM_ISDN,
  161. NCM_LAN,
  162. NCM_PHONE,
  163. NCM_TUNNEL,
  164. NCM_PPPOE,
  165. NCM_BRIDGE,
  166. NCM_SHAREDACCESSHOST_LAN,
  167. NCM_SHAREDACCESSHOST_RAS,
  168. } NETCON_MEDIATYPE;
  169. typedef struct tagNETCON_PROPERTIES
  170. {
  171. GUID guidId;
  172. [string] LPWSTR pszwName;
  173. [string] LPWSTR pszwDeviceName;
  174. NETCON_STATUS Status;
  175. NETCON_MEDIATYPE MediaType;
  176. DWORD dwCharacter;
  177. CLSID clsidThisObject;
  178. CLSID clsidUiObject;
  179. } NETCON_PROPERTIES;
  180. HRESULT Connect();
  181. cpp_quote("#define S_OBJECT_NO_LONGER_VALID ((HRESULT)0x00000002L)")
  182. // Disconnect can return S_OBJECT_NO_LONGER_VALID which indicates
  183. // success, but that the object is no longer valid. Clients, when
  184. // getting this error message, should simply release the interface.
  185. //
  186. HRESULT Disconnect();
  187. HRESULT Delete();
  188. HRESULT Duplicate(
  189. [in, string] LPCWSTR pszwDuplicateName,
  190. [out] INetConnection** ppCon);
  191. HRESULT GetProperties(
  192. [out] NETCON_PROPERTIES** ppProps);
  193. HRESULT GetUiObjectClassId(
  194. [out, ref] CLSID* pclsid);
  195. HRESULT Rename(
  196. [in, string] LPCWSTR pszwNewName);
  197. };
  198. cpp_quote("")
  199. cpp_quote("STDAPI_(VOID) NcFreeNetconProperties (NETCON_PROPERTIES* pProps);")
  200. cpp_quote("")
  201. cpp_quote("")
  202. cpp_quote("STDAPI_(BOOL) NcIsValidConnectionName (PCWSTR pszwName);")
  203. cpp_quote("")
  204. //+---------------------------------------------------------------------------
  205. // INetConnectionManager - The top-level object that contains all of the
  206. // INetConnection objects on a machine.
  207. //
  208. // This interface manages INetConnection objects. It provides methods
  209. // to:
  210. // - Enumerate INetConnections
  211. // - Remove an INetConnection
  212. // - Find an INetConnection
  213. //
  214. // Note: Adding a connection is not yet performed programatically through
  215. // the connection manager. Instead, the shell owns creating connection
  216. // objects through a UI interface.
  217. //
  218. [
  219. object,
  220. uuid(C08956A2-1CD3-11D1-B1C5-00805FC1270E),
  221. pointer_default(unique)
  222. ]
  223. interface INetConnectionManager : IUnknown
  224. {
  225. typedef enum tagNETCONMGR_ENUM_FLAGS
  226. {
  227. NCME_DEFAULT = 0x0,
  228. } NETCONMGR_ENUM_FLAGS;
  229. // Return an IEnumNetConnection interface used to enumerate all of
  230. // the contained connection objects.
  231. //
  232. HRESULT EnumConnections(
  233. [in] NETCONMGR_ENUM_FLAGS Flags,
  234. [out] IEnumNetConnection** ppEnum);
  235. };
  236. //+---------------------------------------------------------------------------
  237. // INetConnectionManagerEvents -
  238. //
  239. [
  240. object,
  241. uuid(C08956BA-1CD3-11D1-B1C5-00805FC1270E),
  242. pointer_default(unique)
  243. ]
  244. interface INetConnectionManagerEvents : IUnknown
  245. {
  246. HRESULT RefreshConnections();
  247. HRESULT Enable();
  248. HRESULT Disable(
  249. [in] ULONG ulDisableTimeout);
  250. };
  251. //+---------------------------------------------------------------------------
  252. // INetConnectionConnectUi -
  253. //
  254. [
  255. local,
  256. object,
  257. uuid(C08956A3-1CD3-11D1-B1C5-00805FC1270E),
  258. pointer_default(unique)
  259. ]
  260. interface INetConnectionConnectUi : IUnknown
  261. {
  262. typedef enum tagNETCONUI_CONNECT_FLAGS
  263. {
  264. NCUC_DEFAULT = 0x0000,
  265. NCUC_NO_UI = 0x0001,
  266. NCUC_ENABLE_DISABLE = 0x0002
  267. } NETCONUI_CONNECT_FLAGS;
  268. HRESULT SetConnection(
  269. [in] INetConnection* pCon);
  270. HRESULT Connect (
  271. [in] HWND hwndParent,
  272. [in] DWORD dwFlags);
  273. HRESULT Disconnect (
  274. [in] HWND hwndParent,
  275. [in] DWORD dwFlags);
  276. };
  277. //+---------------------------------------------------------------------------
  278. // INetConnectionPropertyUi -
  279. //
  280. [
  281. local,
  282. object,
  283. uuid(C08956A4-1CD3-11D1-B1C5-00805FC1270E),
  284. pointer_default(unique)
  285. ]
  286. interface INetConnectionPropertyUi : IUnknown
  287. {
  288. HRESULT SetConnection(
  289. [in] INetConnection* pCon);
  290. HRESULT AddPages (
  291. [in] HWND hwndParent,
  292. [in] LPFNADDPROPSHEETPAGE pfnAddPage,
  293. [in] LPARAM lParam);
  294. };
  295. //+---------------------------------------------------------------------------
  296. // INetConnectionPropertyUi2 -
  297. //
  298. [
  299. local,
  300. object,
  301. uuid(C08956B9-1CD3-11D1-B1C5-00805FC1270E),
  302. pointer_default(unique)
  303. ]
  304. interface INetConnectionPropertyUi2 : INetConnectionPropertyUi
  305. {
  306. HRESULT GetIcon(
  307. [in] DWORD dwSize,
  308. [out] HICON *phIcon);
  309. };
  310. //+---------------------------------------------------------------------------
  311. // INetConnectionCommonUi -
  312. //
  313. [
  314. local,
  315. object,
  316. uuid(C08956A5-1CD3-11D1-B1C5-00805FC1270E),
  317. pointer_default(unique)
  318. ]
  319. interface INetConnectionCommonUi : IUnknown
  320. {
  321. typedef enum tagNETCON_CHOOSEFLAGS
  322. {
  323. NCCHF_CONNECT = 0x0001, // Selected Connection is activated
  324. // and returned. If not set then
  325. // the selected connection interface
  326. // is returned without being activated
  327. NCCHF_CAPTION = 0x0002,
  328. NCCHF_OKBTTNTEXT = 0x0004,
  329. NCCHF_DISABLENEW = 0x0008,
  330. NCCHF_AUTOSELECT = 0x0010, // Automatically Choose or Connect,
  331. // based upon NCCHF_CONNECT if only
  332. // one connection matches the
  333. // dwTypeMask.
  334. } NETCON_CHOOSEFLAGS;
  335. typedef enum tagNETCON_CHOOSETYPE
  336. {
  337. NCCHT_DIRECT_CONNECT = 0x0001,
  338. NCCHT_LAN = 0x0002,
  339. NCCHT_PHONE = 0x0004,
  340. NCCHT_TUNNEL = 0x0008,
  341. NCCHT_ISDN = 0x0010,
  342. NCCHT_ALL = 0x001F
  343. } NETCON_CHOOSETYPE;
  344. typedef struct tagNETCON_CHOOSECONN
  345. {
  346. DWORD lStructSize;
  347. HWND hwndParent;
  348. DWORD dwFlags; // Combine NCCHF_* flags
  349. DWORD dwTypeMask; // Combine NCCHT_* flags
  350. LPCWSTR lpstrCaption;
  351. LPCWSTR lpstrOkBttnText;
  352. } NETCON_CHOOSECONN;
  353. HRESULT ChooseConnection(
  354. [in] NETCON_CHOOSECONN * pChooseConn,
  355. [out] INetConnection** ppCon);
  356. HRESULT ShowConnectionProperties (
  357. [in] HWND hwndParent,
  358. [in] INetConnection* pCon);
  359. HRESULT StartNewConnectionWizard (
  360. [in] HWND hwndParent,
  361. [out] INetConnection** ppCon);
  362. };
  363. //+---------------------------------------------------------------------------
  364. // IEnumNetSharingPortMapping - An enumerator for INetSharingPortMapping objects.
  365. //
  366. [
  367. object,
  368. uuid(C08956B0-1CD3-11D1-B1C5-00805FC1270E),
  369. pointer_default(unique)
  370. ]
  371. interface IEnumNetSharingPortMapping : IUnknown
  372. {
  373. HRESULT Next(
  374. [in] ULONG celt,
  375. [out, size_is(celt), length_is(*pceltFetched)]
  376. VARIANT * rgVar,
  377. [out] ULONG* pceltFetched);
  378. HRESULT Skip(
  379. [in] ULONG celt);
  380. HRESULT Reset();
  381. HRESULT Clone(
  382. [out] IEnumNetSharingPortMapping** ppenum);
  383. };
  384. [
  385. object,
  386. uuid(24B7E9B5-E38F-4685-851B-00892CF5F940),
  387. oleautomation, dual,
  388. pointer_default(unique)
  389. ]
  390. interface INetSharingPortMappingProps : IDispatch
  391. {
  392. [propget, id(1), helpstring("property Name")] HRESULT Name ([out, retval] BSTR * pbstrName);
  393. [propget, id(2), helpstring("property IPProtocol")] HRESULT IPProtocol ([out, retval] UCHAR * pucIPProt);
  394. [propget, id(3), helpstring("property ExternalPort")] HRESULT ExternalPort ([out, retval] long * pusPort);
  395. [propget, id(4), helpstring("property InternalPort")] HRESULT InternalPort ([out, retval] long * pusPort);
  396. [propget, id(5), helpstring("property Options")] HRESULT Options ([out, retval] long * pdwOptions);
  397. [propget, id(6), helpstring("property TargetName")] HRESULT TargetName ([out, retval] BSTR * pbstrTargetName);
  398. [propget, id(7), helpstring("property TargetIPAddress")] HRESULT TargetIPAddress([out, retval] BSTR * pbstrTargetIPAddress);
  399. [propget, id(8), helpstring("property Enabled")] HRESULT Enabled ([out, retval] VARIANT_BOOL * pbool);
  400. };
  401. //+---------------------------------------------------------------------------
  402. // INetSharingPortMapping -
  403. //
  404. [
  405. object,
  406. uuid(C08956B1-1CD3-11D1-B1C5-00805FC1270E),
  407. oleautomation, dual,
  408. pointer_default(unique)
  409. ]
  410. interface INetSharingPortMapping : IDispatch
  411. {
  412. [id(1), helpstring("method Disable")]
  413. HRESULT Disable();
  414. [id(2), helpstring("method Enable")]
  415. HRESULT Enable();
  416. [propget, id(3), helpstring("property Properties")]
  417. HRESULT Properties(
  418. [out, retval] INetSharingPortMappingProps ** ppNSPMP);
  419. [id(4), helpstring("method Delete")]
  420. HRESULT Delete();
  421. };
  422. //+---------------------------------------------------------------------------
  423. // IEnumNetSharingEveryConnection - An enumerator for INetConnection interface pointers
  424. // that represent all connections in the connections folder
  425. //
  426. [
  427. object,
  428. uuid(C08956B8-1CD3-11D1-B1C5-00805FC1270E),
  429. pointer_default(unique)
  430. ]
  431. interface IEnumNetSharingEveryConnection : IUnknown
  432. {
  433. HRESULT Next(
  434. [in] ULONG celt,
  435. [out, size_is(celt), length_is(*pceltFetched)]
  436. VARIANT * rgVar,
  437. [out] ULONG* pceltFetched);
  438. HRESULT Skip(
  439. [in] ULONG celt);
  440. HRESULT Reset();
  441. HRESULT Clone(
  442. [out] IEnumNetSharingEveryConnection** ppenum);
  443. };
  444. //+---------------------------------------------------------------------------
  445. // IEnumNetSharingPublicConnection - An enumerator for INetConnection interface pointers
  446. // that represent connections configured as publicly shared.
  447. //
  448. [
  449. object,
  450. uuid(C08956B4-1CD3-11D1-B1C5-00805FC1270E),
  451. pointer_default(unique)
  452. ]
  453. interface IEnumNetSharingPublicConnection : IUnknown
  454. {
  455. HRESULT Next(
  456. [in] ULONG celt,
  457. [out, size_is(celt), length_is(*pceltFetched)]
  458. VARIANT * rgVar,
  459. [out] ULONG* pceltFetched);
  460. HRESULT Skip(
  461. [in] ULONG celt);
  462. HRESULT Reset();
  463. HRESULT Clone(
  464. [out] IEnumNetSharingPublicConnection** ppenum);
  465. };
  466. //+---------------------------------------------------------------------------
  467. // IEnumNetSharingPrivateConnection - An enumerator for INetConnection interface pointers
  468. // that represent connections configured as privately shared.
  469. //
  470. [
  471. object,
  472. uuid(C08956B5-1CD3-11D1-B1C5-00805FC1270E),
  473. pointer_default(unique)
  474. ]
  475. interface IEnumNetSharingPrivateConnection : IUnknown
  476. {
  477. HRESULT Next(
  478. [in] ULONG celt,
  479. [out, size_is(celt), length_is(*pCeltFetched)] VARIANT * rgVar,
  480. [out] ULONG * pCeltFetched);
  481. HRESULT Skip(
  482. [in] ULONG celt);
  483. HRESULT Reset();
  484. HRESULT Clone(
  485. [out] IEnumNetSharingPrivateConnection** ppenum);
  486. };
  487. // Collection needed for INetSharingConfiguration::EnumPortMappings() below
  488. [
  489. object,
  490. uuid(02E4A2DE-DA20-4E34-89C8-AC22275A010B),
  491. oleautomation, dual,
  492. helpstring("INetSharingPortMappingCollection Interface"),
  493. pointer_default(unique)
  494. ]
  495. interface INetSharingPortMappingCollection : IDispatch
  496. {
  497. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum: gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  498. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  499. };
  500. cpp_quote("// properties for INetConnection (wraps NETCON_PROPERTIES)")
  501. [
  502. object,
  503. uuid(F4277C95-CE5B-463D-8167-5662D9BCAA72),
  504. oleautomation, dual,
  505. helpstring("INetConnectionProps Interface"),
  506. pointer_default(unique)
  507. ]
  508. interface INetConnectionProps : IDispatch
  509. {
  510. [propget, id(1), helpstring("property Guid")]
  511. HRESULT Guid ([out, retval] BSTR * pbstrGuid);
  512. [propget, id(2), helpstring("property Name")]
  513. HRESULT Name ([out, retval] BSTR * pbstrName);
  514. [propget, id(3), helpstring("property DeviceName")]
  515. HRESULT DeviceName ([out, retval] BSTR * pbstrDeviceName);
  516. [propget, id(4), helpstring("property Status")]
  517. HRESULT Status ([out, retval] NETCON_STATUS * pStatus);
  518. [propget, id(5), helpstring("property MediaType")]
  519. HRESULT MediaType ([out, retval] NETCON_MEDIATYPE * pMediaType);
  520. [propget, id(6), helpstring("property Characteristics")]
  521. HRESULT Characteristics ([out, retval] DWORD * pdwFlags);
  522. };
  523. //+---------------------------------------------------------------------------
  524. // INetSharingConfiguration - the connection level object that
  525. //
  526. // It provides methods to:
  527. // - Enable/Disable Internet Connection Sharing
  528. // - Enable/Disable Internet Connection Protection
  529. // - Enumerate Port Mappings
  530. // - Add Port Mappings
  531. //
  532. [
  533. object,
  534. uuid(C08956B6-1CD3-11D1-B1C5-00805FC1270E),
  535. oleautomation, dual,
  536. pointer_default(unique)
  537. ]
  538. interface INetSharingConfiguration : IDispatch
  539. {
  540. typedef enum tagSHARINGCONNECTIONTYPE
  541. {
  542. ICSSHARINGTYPE_PUBLIC = 0x0,
  543. ICSSHARINGTYPE_PRIVATE
  544. }
  545. SHARINGCONNECTIONTYPE, *LPSHARINGCONNECTIONTYPE;
  546. typedef enum tagSHARINGCONNECTION_ENUM_FLAGS
  547. {
  548. ICSSC_DEFAULT = 0x0,
  549. ICSSC_ENABLED
  550. }
  551. SHARINGCONNECTION_ENUM_FLAGS;
  552. typedef enum tagICS_TARGETTYPE
  553. {
  554. ICSTT_NAME = 0x0,
  555. ICSTT_IPADDRESS
  556. }
  557. ICS_TARGETTYPE;
  558. [propget, id(1), helpstring("property SharingEnabled")]
  559. HRESULT SharingEnabled([out, retval] VARIANT_BOOL* pbEnabled);
  560. [propget, id(2), helpstring("property SharingConnectionType")]
  561. HRESULT SharingConnectionType([out, retval] SHARINGCONNECTIONTYPE* pType);
  562. [id(3), helpstring("method DisableSharing")]
  563. HRESULT DisableSharing();
  564. [id(4), helpstring("method EnableSharing")]
  565. HRESULT EnableSharing([in] SHARINGCONNECTIONTYPE Type );
  566. [propget, id(5), helpstring("property InternetFirewallEnabled")]
  567. HRESULT InternetFirewallEnabled([out, retval] VARIANT_BOOL *pbEnabled );
  568. [id(6), helpstring("method DisableInternetFirewall")]
  569. HRESULT DisableInternetFirewall();
  570. [id(7), helpstring("method EnableInternetFirewall")]
  571. HRESULT EnableInternetFirewall();
  572. // Return an IEnumNetSharingPortMapping interface used to enumerate all of
  573. // the contained INetSharingPortMapping objects.
  574. //
  575. [propget, id(8), helpstring("EnumPortMappings")]
  576. HRESULT EnumPortMappings(
  577. [in] SHARINGCONNECTION_ENUM_FLAGS Flags,
  578. [out, retval] INetSharingPortMappingCollection** ppColl);
  579. [id(9), helpstring("method AddPortMapping")]
  580. HRESULT AddPortMapping(
  581. [in] BSTR bstrName,
  582. [in] UCHAR ucIPProtocol,
  583. [in] USHORT usExternalPort,
  584. [in] USHORT usInternalPort,
  585. [in] DWORD dwOptions,
  586. [in] BSTR bstrTargetNameOrIPAddress,
  587. [in] ICS_TARGETTYPE eTargetType,
  588. [out, retval] INetSharingPortMapping** ppMapping );
  589. [id(10), helpstring("method RemovePortMapping")]
  590. HRESULT RemovePortMapping([in] INetSharingPortMapping* pMapping );
  591. };
  592. // ICollection interfaces
  593. [
  594. object,
  595. uuid(33C4643C-7811-46FA-A89A-768597BD7223),
  596. oleautomation, dual,
  597. helpstring("INetSharingEveryConnectionCollection Interface"),
  598. pointer_default(unique)
  599. ]
  600. interface INetSharingEveryConnectionCollection : IDispatch
  601. {
  602. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum: gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  603. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  604. };
  605. [
  606. object,
  607. uuid(7D7A6355-F372-4971-A149-BFC927BE762A),
  608. oleautomation, dual,
  609. helpstring("INetSharingPublicConnectionCollection Interface"),
  610. pointer_default(unique)
  611. ]
  612. interface INetSharingPublicConnectionCollection : IDispatch
  613. {
  614. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum: gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  615. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  616. };
  617. [
  618. object,
  619. uuid(38AE69E0-4409-402A-A2CB-E965C727F840),
  620. oleautomation, dual,
  621. helpstring("INetSharingPrivateConnectionCollection Interface"),
  622. pointer_default(unique)
  623. ]
  624. interface INetSharingPrivateConnectionCollection : IDispatch
  625. {
  626. [propget, id(DISPID_NEWENUM), restricted, helpstring("property _NewEnum: gets item enumerator")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
  627. [propget, id(1), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
  628. };
  629. //+---------------------------------------------------------------------------
  630. // INetSharingManager - the top level object that
  631. //
  632. // It provides methods to:
  633. // - Determine whether Internet Connection Sharing is installed
  634. // - Enumerate Public Connections
  635. // - Enumerate Private Connections
  636. //
  637. [
  638. object,
  639. uuid(C08956B7-1CD3-11D1-B1C5-00805FC1270E),
  640. oleautomation, dual,
  641. pointer_default(unique)
  642. ]
  643. interface INetSharingManager : IDispatch
  644. {
  645. [propget, id(1), helpstring("property SharingInstalled")]
  646. HRESULT SharingInstalled([out, retval] VARIANT_BOOL *pbInstalled );
  647. // Return an IEnumNetSharingPublicConnection interface used to enumerate all of
  648. // the contained INetConnections configured as a public adapter
  649. //
  650. [propget, id(2), helpstring("EnumPublicConnections")]
  651. HRESULT EnumPublicConnections(
  652. [in] SHARINGCONNECTION_ENUM_FLAGS Flags,
  653. [out, retval] INetSharingPublicConnectionCollection ** ppColl);
  654. // Return an IEnumNetSharingPrivateConnection interface used to enumerate all of
  655. // the contained INetConnections configured as a private adapter
  656. //
  657. [propget, id(3), helpstring("EnumPrivateConnections")]
  658. HRESULT EnumPrivateConnections(
  659. [in] SHARINGCONNECTION_ENUM_FLAGS Flags,
  660. [out, retval] INetSharingPrivateConnectionCollection ** ppColl);
  661. [propget, id(6), helpstring("INetSharingConfigurationForINetConnection")]
  662. HRESULT INetSharingConfigurationForINetConnection(
  663. [in] INetConnection *pNetConnection,
  664. [out, retval] INetSharingConfiguration **ppNetSharingConfiguration
  665. );
  666. // Return an IEnumNetSharingEveryConnection interface used to enumerate all of
  667. // the contained INetConnections configured as a public adapter
  668. //
  669. [propget, id(7), helpstring("EnumEveryConnection")]
  670. HRESULT EnumEveryConnection([out, retval] INetSharingEveryConnectionCollection ** ppColl);
  671. // get properties interface for any INetConnection
  672. [propget, id(8), helpstring("NetConnectionProps")]
  673. HRESULT NetConnectionProps(
  674. [in] INetConnection *pNetConnection,
  675. [out, retval] INetConnectionProps ** ppProps);
  676. };
  677. [
  678. uuid(43E734CA-043D-4A70-9A2C-A8F254063D91),
  679. version(1.0),
  680. helpstring("NetCon 1.0 Type Library")
  681. ]
  682. library NETCONLib
  683. {
  684. importlib("stdole2.tlb");
  685. [
  686. uuid(5C63C1AD-3956-4FF8-8486-40034758315B),
  687. helpstring("NetSharingManager Class")
  688. ]
  689. coclass NetSharingManager
  690. {
  691. [default] interface INetSharingManager;
  692. };
  693. };