netfw.idl 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation.
  4. //
  5. // SYNOPSIS
  6. //
  7. // Interfaces for managing the firewall.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. import "icftypes.idl";
  11. import "oaidl.idl";
  12. // Provides access to the settings controlling Remote Administration. An
  13. // instance of this interface is retrieved through the RemoteAdminSettings
  14. // property of the INetFwProfile interface. All configuration changes take
  15. // effect immediately.
  16. [
  17. object,
  18. uuid(D4BECDDF-6F73-4A83-B832-9C66874CD20E),
  19. dual
  20. ]
  21. interface INetFwRemoteAdminSettings : IDispatch
  22. {
  23. // IP version for which remote admin is authorized. Only
  24. // NET_FW_IP_VERSION_ANY is supported.
  25. [id(1), propget]
  26. HRESULT IpVersion(
  27. [out, retval] NET_FW_IP_VERSION* ipVersion
  28. );
  29. [id(1), propput]
  30. HRESULT IpVersion(
  31. [in] NET_FW_IP_VERSION ipVersion
  32. );
  33. // Network scope from which remote admin is allowed. When setting the
  34. // property, only NET_FW_SCOPE_ALL and NET_FW_SCOPE_LOCAL_SUBNET are valid.
  35. // To create a custom scope, use the RemoteAddresses property.
  36. [id(2), propget]
  37. HRESULT Scope(
  38. [out, retval] NET_FW_SCOPE* scope
  39. );
  40. [id(2), propput]
  41. HRESULT Scope(
  42. [in] NET_FW_SCOPE scope
  43. );
  44. // Remote addresses from which remote administration is allowed.
  45. [id(3), propget]
  46. HRESULT RemoteAddresses(
  47. [out, retval] BSTR* remoteAddrs
  48. );
  49. [id(3), propput]
  50. HRESULT RemoteAddresses(
  51. [in] BSTR remoteAddrs
  52. );
  53. // True if Remote Administration is enabled.
  54. [id(4), propget]
  55. HRESULT Enabled(
  56. [out, retval] VARIANT_BOOL* enabled
  57. );
  58. [id(4), propput]
  59. HRESULT Enabled(
  60. [in] VARIANT_BOOL enabled
  61. );
  62. }
  63. // Provides access to the settings controlling ICMP packets. An instance of
  64. // this interface is retrieved through the IcmpSettings property of the
  65. // INetFwProfile interface. All configuration changes take effect
  66. // immediately.
  67. [
  68. object,
  69. uuid(A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD),
  70. dual
  71. ]
  72. interface INetFwIcmpSettings : IDispatch
  73. {
  74. //////////
  75. // Types common to IPv4 and IPv6
  76. //////////
  77. [id(1), propget]
  78. HRESULT AllowOutboundDestinationUnreachable(
  79. [out, retval] VARIANT_BOOL* allow
  80. );
  81. [id(1), propput]
  82. HRESULT AllowOutboundDestinationUnreachable(
  83. [in] VARIANT_BOOL allow
  84. );
  85. [id(2), propget]
  86. HRESULT AllowRedirect(
  87. [out, retval] VARIANT_BOOL* allow
  88. );
  89. [id(2), propput]
  90. HRESULT AllowRedirect(
  91. [in] VARIANT_BOOL allow
  92. );
  93. [id(3), propget]
  94. HRESULT AllowInboundEchoRequest(
  95. [out, retval] VARIANT_BOOL* allow
  96. );
  97. [id(3), propput]
  98. HRESULT AllowInboundEchoRequest(
  99. [in] VARIANT_BOOL allow
  100. );
  101. [id(4), propget]
  102. HRESULT AllowOutboundTimeExceeded(
  103. [out, retval] VARIANT_BOOL* allow
  104. );
  105. [id(4), propput]
  106. HRESULT AllowOutboundTimeExceeded(
  107. [in] VARIANT_BOOL allow
  108. );
  109. [id(5), propget]
  110. HRESULT AllowOutboundParameterProblem(
  111. [out, retval] VARIANT_BOOL* allow
  112. );
  113. [id(5), propput]
  114. HRESULT AllowOutboundParameterProblem(
  115. [in] VARIANT_BOOL allow
  116. );
  117. //////////
  118. // IPv4 only types
  119. //////////
  120. [id(6), propget]
  121. HRESULT AllowOutboundSourceQuench(
  122. [out, retval] VARIANT_BOOL* allow
  123. );
  124. [id(6), propput]
  125. HRESULT AllowOutboundSourceQuench(
  126. [in] VARIANT_BOOL allow
  127. );
  128. [id(7), propget]
  129. HRESULT AllowInboundRouterRequest(
  130. [out, retval] VARIANT_BOOL* allow
  131. );
  132. [id(7), propput]
  133. HRESULT AllowInboundRouterRequest(
  134. [in] VARIANT_BOOL allow
  135. );
  136. [id(8), propget]
  137. HRESULT AllowInboundTimestampRequest(
  138. [out, retval] VARIANT_BOOL* allow
  139. );
  140. [id(8), propput]
  141. HRESULT AllowInboundTimestampRequest(
  142. [in] VARIANT_BOOL allow
  143. );
  144. [id(9), propget]
  145. HRESULT AllowInboundMaskRequest(
  146. [out, retval] VARIANT_BOOL* allow
  147. );
  148. [id(9), propput]
  149. HRESULT AllowInboundMaskRequest(
  150. [in] VARIANT_BOOL allow
  151. );
  152. //////////
  153. // IPv6 only types
  154. //////////
  155. [id(10), propget]
  156. HRESULT AllowOutboundPacketTooBig(
  157. [out, retval] VARIANT_BOOL* allow
  158. );
  159. [id(10), propput]
  160. HRESULT AllowOutboundPacketTooBig(
  161. [in] VARIANT_BOOL allow
  162. );
  163. }
  164. // Provides access to the properties of a port that has been opened in the
  165. // firewall. When creating new ports, this interface is supported by the
  166. // HNetCfg.FwOpenPort COM object. For reading or modifying existing ports,
  167. // instances of this interface are retrieved through the INetFwOpenPorts
  168. // collection. All configuration changes take effect immediately.
  169. [
  170. object,
  171. uuid(E0483BA0-47FF-4D9C-A6D6-7741D0B195F7),
  172. dual
  173. ]
  174. interface INetFwOpenPort : IDispatch
  175. {
  176. // Friendly name of the port. Mandatory.
  177. [id(1), propget]
  178. HRESULT Name(
  179. [out, retval] BSTR* name
  180. );
  181. [id(1), propput]
  182. HRESULT Name(
  183. [in] BSTR name
  184. );
  185. // IP version for which the port is opened. Only NET_FW_IP_VERSION_ANY is
  186. // supported, and this is the default for new ports.
  187. [id(2), propget]
  188. HRESULT IpVersion(
  189. [out, retval] NET_FW_IP_VERSION* ipVersion
  190. );
  191. [id(2), propput]
  192. HRESULT IpVersion(
  193. [in] NET_FW_IP_VERSION ipVersion
  194. );
  195. // IP protocol. Default is TCP for new ports.
  196. [id(3), propget]
  197. HRESULT Protocol(
  198. [out, retval] NET_FW_IP_PROTOCOL* ipProtocol
  199. );
  200. [id(3), propput]
  201. HRESULT Protocol(
  202. [in] NET_FW_IP_PROTOCOL ipProtocol
  203. );
  204. // Port number in host order. Mandatory.
  205. [id(4), propget]
  206. HRESULT Port(
  207. [out, retval] LONG* portNumber
  208. );
  209. [id(4), propput]
  210. HRESULT Port(
  211. [in] LONG portNumber
  212. );
  213. // Network scope from which the port can listen. When setting the property,
  214. // only NET_FW_SCOPE_ALL and NET_FW_SCOPE_LOCAL_SUBNET are valid. To create
  215. // a custom scope, use the RemoteAddresses property. Default is
  216. // NET_FW_SCOPE_ALL for new ports.
  217. [id(5), propget]
  218. HRESULT Scope(
  219. [out, retval] NET_FW_SCOPE* scope
  220. );
  221. [id(5), propput]
  222. HRESULT Scope(
  223. [in] NET_FW_SCOPE scope
  224. );
  225. // Remote addresses from which the port can listen for traffic.
  226. [id(6), propget]
  227. HRESULT RemoteAddresses(
  228. [out, retval] BSTR* remoteAddrs
  229. );
  230. [id(6), propput]
  231. HRESULT RemoteAddresses(
  232. [in] BSTR remoteAddrs
  233. );
  234. // True if the settings for this port are currently enabled. This can be set
  235. // to False to allow port settings to be stored in the open ports collection
  236. // without actually opening the port. Default is True for new ports.
  237. [id(7), propget]
  238. HRESULT Enabled(
  239. [out, retval] VARIANT_BOOL* enabled
  240. );
  241. [id(7), propput]
  242. HRESULT Enabled(
  243. [in] VARIANT_BOOL enabled
  244. );
  245. // True if this is a built-in port defined by the system. Built-in ports can
  246. // not be removed and only the LocalSubnetOnly and Enabled properties can be
  247. // modified.
  248. [id(8), propget]
  249. HRESULT BuiltIn(
  250. [out, retval] VARIANT_BOOL* builtIn
  251. );
  252. }
  253. // Provides access to a collection of ports opened in the firewall. An instance
  254. // of this interface is retrieved through the GloballyOpenPorts property of the
  255. // INetFwProfile interface. All configuration changes take effect
  256. // immediately.
  257. [
  258. object,
  259. uuid(C0E9D7FA-E07E-430A-B19A-090CE82D92E2),
  260. dual
  261. ]
  262. interface INetFwOpenPorts : IDispatch
  263. {
  264. // Returns the number of ports in the collection.
  265. [id(1), propget]
  266. HRESULT Count(
  267. [out, retval] long* count
  268. );
  269. // Opens a new port and adds it to the collection. If the port is already
  270. // open, the existing settings are overwritten.
  271. [id(2)]
  272. HRESULT Add(
  273. [in] INetFwOpenPort* port
  274. );
  275. // Closes a port and remove it from the collection. If the port is already
  276. // closed, it has no effect.
  277. [id(3)]
  278. HRESULT Remove(
  279. [in] LONG portNumber,
  280. [in] NET_FW_IP_PROTOCOL ipProtocol
  281. );
  282. // Return the specified port if present.
  283. [id(4)]
  284. HRESULT Item(
  285. [in] LONG portNumber,
  286. [in] NET_FW_IP_PROTOCOL ipProtocol,
  287. [out, retval] INetFwOpenPort** openPort
  288. );
  289. // Returns an object supporting IEnumVARIANT that can be used to iterate
  290. // through all the ports in the collection.
  291. [id(DISPID_NEWENUM), propget, restricted]
  292. HRESULT _NewEnum(
  293. [out, retval] IUnknown** newEnum
  294. );
  295. }
  296. // Provides access to the properties of a service that may be authorized to
  297. // listen through the firewall. Instances of this interface are retrieved
  298. // through the INetFwServices collection. All configuration changes take
  299. // effect immediately.
  300. [
  301. object,
  302. uuid(79FD57C8-908E-4A36-9888-D5B3F0A444CF),
  303. dual
  304. ]
  305. interface INetFwService : IDispatch
  306. {
  307. // Friendly name of the service.
  308. [id(1), propget]
  309. HRESULT Name(
  310. [out, retval] BSTR* name
  311. );
  312. // Enumerator that uniquely identifies the service.
  313. [id(2), propget]
  314. HRESULT Type(
  315. [out, retval] NET_FW_SERVICE_TYPE* type
  316. );
  317. // Indicates whether at least one of the ports associated with the service
  318. // has been customized. If a service has been customized, the values
  319. // returned by the service properties do not reflect the configuration of
  320. // all the ports associated with the service.
  321. [id(3), propget]
  322. HRESULT Customized(
  323. [out, retval] VARIANT_BOOL* customized
  324. );
  325. // IP version for which the service is authorized. Only
  326. // NET_FW_IP_VERSION_ANY is supported.
  327. [id(4), propget]
  328. HRESULT IpVersion(
  329. [out, retval] NET_FW_IP_VERSION* ipVersion
  330. );
  331. [id(4), propput]
  332. HRESULT IpVersion(
  333. [in] NET_FW_IP_VERSION ipVersion
  334. );
  335. // Network scope from which the service can listen. When setting the
  336. // property, only NET_FW_SCOPE_ALL and NET_FW_SCOPE_LOCAL_SUBNET are valid.
  337. // To create a custom scope, use the RemoteAddresses property.
  338. [id(5), propget]
  339. HRESULT Scope(
  340. [out, retval] NET_FW_SCOPE* scope
  341. );
  342. [id(5), propput]
  343. HRESULT Scope(
  344. [in] NET_FW_SCOPE scope
  345. );
  346. // Remote addresses from which the service ports can listen for traffic. If
  347. // the service has been customized, get returns the union of the remote
  348. // addresses for all the service ports.
  349. [id(6), propget]
  350. HRESULT RemoteAddresses(
  351. [out, retval] BSTR* remoteAddrs
  352. );
  353. [id(6), propput]
  354. HRESULT RemoteAddresses(
  355. [in] BSTR remoteAddrs
  356. );
  357. // True if all the ports associated with the service are enabled.
  358. [id(7), propget]
  359. HRESULT Enabled(
  360. [out, retval] VARIANT_BOOL* enabled
  361. );
  362. [id(7), propput]
  363. HRESULT Enabled(
  364. [in] VARIANT_BOOL enabled
  365. );
  366. // The collection of globally open ports associated with the service.
  367. [id(8), propget]
  368. HRESULT GloballyOpenPorts(
  369. [out, retval] INetFwOpenPorts** openPorts
  370. );
  371. }
  372. // Provides access to a collection of services that may be authorized to listen
  373. // through the firewall. An instance of this interface is retrieved through the
  374. // Services property of the INetFwProfile interface. All configuration
  375. // changes take effect immediately.
  376. [
  377. object,
  378. uuid(79649BB4-903E-421B-94C9-79848E79F6EE),
  379. dual
  380. ]
  381. interface INetFwServices : IDispatch
  382. {
  383. // Returns the number of services in the collection.
  384. [id(1), propget]
  385. HRESULT Count(
  386. [out, retval] long* count
  387. );
  388. // Return the specified service.
  389. [id(2)]
  390. HRESULT Item(
  391. [in] NET_FW_SERVICE_TYPE svcType,
  392. [out, retval] INetFwService** service
  393. );
  394. // Returns an object supporting IEnumVARIANT that can be used to iterate
  395. // through all the services in the collection.
  396. [id(DISPID_NEWENUM), propget, restricted]
  397. HRESULT _NewEnum(
  398. [out, retval] IUnknown** newEnum
  399. );
  400. }
  401. // Provides access to the properties of an app that has been authorized to open
  402. // holes in the firewall. When creating new apps, this interface is supported
  403. // by the HNetCfg.FwAuthorizedApplication COM object. For reading or
  404. // modifying existing apps, instances of this interface are retrieved through
  405. // the INetFwAuthorizedApplications collection. All configuration changes
  406. // take effect immediately.
  407. [
  408. object,
  409. uuid(B5E64FFA-C2C5-444E-A301-FB5E00018050),
  410. dual
  411. ]
  412. interface INetFwAuthorizedApplication : IDispatch
  413. {
  414. // Friendly name of the app. Mandatory.
  415. [id(1), propget]
  416. HRESULT Name(
  417. [out, retval] BSTR* name
  418. );
  419. [id(1), propput]
  420. HRESULT Name(
  421. [in] BSTR name
  422. );
  423. // Process image file name. This must be a fully-qualified path, but it may
  424. // contain environment variables. Mandatory.
  425. [id(2), propget]
  426. HRESULT ProcessImageFileName(
  427. [out, retval] BSTR* imageFileName
  428. );
  429. [id(2), propput]
  430. HRESULT ProcessImageFileName(
  431. [in] BSTR imageFileName
  432. );
  433. // IP version for which the app is authorized. Only NET_FW_IP_VERSION_ANY is
  434. // supported, and this is the default for new apps.
  435. [id(3), propget]
  436. HRESULT IpVersion(
  437. [out, retval] NET_FW_IP_VERSION* ipVersion
  438. );
  439. [id(3), propput]
  440. HRESULT IpVersion(
  441. [in] NET_FW_IP_VERSION ipVersion
  442. );
  443. // Network scope from which the app can listen. When setting the property,
  444. // only NET_FW_SCOPE_ALL and NET_FW_SCOPE_LOCAL_SUBNET are valid. To create
  445. // a custom scope, use the RemoteAddresses property. Default is
  446. // NET_FW_SCOPE_ALL for new apps.
  447. [id(4), propget]
  448. HRESULT Scope(
  449. [out, retval] NET_FW_SCOPE* scope
  450. );
  451. [id(4), propput]
  452. HRESULT Scope(
  453. [in] NET_FW_SCOPE scope
  454. );
  455. // Remote addresses from which the app can listen for traffic.
  456. [id(5), propget]
  457. HRESULT RemoteAddresses(
  458. [out, retval] BSTR* remoteAddrs
  459. );
  460. [id(5), propput]
  461. HRESULT RemoteAddresses(
  462. [in] BSTR remoteAddrs
  463. );
  464. // True if the settings for this app are currently enabled. This can be set
  465. // to False to allow app settings to be stored in the authorized apps
  466. // collection without actually authorizing the app. Default is True for new
  467. // apps.
  468. [id(6), propget]
  469. HRESULT Enabled(
  470. [out, retval] VARIANT_BOOL* enabled
  471. );
  472. [id(6), propput]
  473. HRESULT Enabled(
  474. [in] VARIANT_BOOL enabled
  475. );
  476. }
  477. // Provides access to a collection of apps authorized to open ports in the
  478. // firewall. An instance of this interface is retrieved through the
  479. // AuthorizedApplications property of the INetFwProfile interface. All
  480. // configuration changes take effect immediately.
  481. [
  482. object,
  483. uuid(644EFD52-CCF9-486C-97A2-39F352570B30),
  484. dual
  485. ]
  486. interface INetFwAuthorizedApplications : IDispatch
  487. {
  488. // Returns the number of apps in the collection.
  489. [id(1), propget]
  490. HRESULT Count(
  491. [out, retval] long* count
  492. );
  493. // Adds a new app to the collection. If an app with the same image file name
  494. // already exists, the settings are overwritten.
  495. [id(2)]
  496. HRESULT Add(
  497. [in] INetFwAuthorizedApplication* app
  498. );
  499. // Removes an app from the collection. If the app doesn't exist, it has no
  500. // effect.
  501. [id(3)]
  502. HRESULT Remove(
  503. [in] BSTR imageFileName
  504. );
  505. // Return the specified app if present.
  506. [id(4)]
  507. HRESULT Item(
  508. [in] BSTR imageFileName,
  509. [out, retval] INetFwAuthorizedApplication** app
  510. );
  511. // Returns an object supporting IEnumVARIANT that can be used to iterate
  512. // through all the apps in the collection.
  513. [id(DISPID_NEWENUM), propget, restricted]
  514. HRESULT _NewEnum(
  515. [out, retval] IUnknown** newEnum
  516. );
  517. }
  518. // Provides access to a firewall settings profile. Instances of this interface
  519. // are retrieved through the CurrentProfile property or GetProfileByType method
  520. // of the INetFwPolicy interface. All configuration changes take effect
  521. // immediately.
  522. [
  523. object,
  524. uuid(174A0DDA-E9F9-449D-993B-21AB667CA456),
  525. dual
  526. ]
  527. interface INetFwProfile : IDispatch
  528. {
  529. // Type of profile
  530. [id(1), propget]
  531. HRESULT Type(
  532. [out, retval] NET_FW_PROFILE_TYPE* type
  533. );
  534. // True if firewall is enabled.
  535. [id(2), propget]
  536. HRESULT FirewallEnabled(
  537. [out, retval] VARIANT_BOOL* enabled
  538. );
  539. [id(2), propput]
  540. HRESULT FirewallEnabled(
  541. [in] VARIANT_BOOL enabled
  542. );
  543. // True if the firewall should not allow exceptions. In other words, all the
  544. // exceptions (e.g., GloballyOpenPorts) specified in the profile are ignored
  545. // and only locally initiated traffic is allowed.
  546. [id(3), propget]
  547. HRESULT ExceptionsNotAllowed(
  548. [out, retval] VARIANT_BOOL* notAllowed
  549. );
  550. [id(3), propput]
  551. HRESULT ExceptionsNotAllowed(
  552. [in] VARIANT_BOOL notAllowed
  553. );
  554. // True if interactive firewall notifications are disabled.
  555. [id(4), propget]
  556. HRESULT NotificationsDisabled(
  557. [out, retval] VARIANT_BOOL* disabled
  558. );
  559. [id(4), propput]
  560. HRESULT NotificationsDisabled(
  561. [in] VARIANT_BOOL disabled
  562. );
  563. // True if the firewall should not allow unicast responses to multicast and
  564. // broadcast traffic.
  565. [id(5), propget]
  566. HRESULT UnicastResponsesToMulticastBroadcastDisabled(
  567. [out, retval] VARIANT_BOOL* disabled
  568. );
  569. [id(5), propput]
  570. HRESULT UnicastResponsesToMulticastBroadcastDisabled(
  571. [in] VARIANT_BOOL disabled
  572. );
  573. // Settings governing remote administration.
  574. [id(6), propget]
  575. HRESULT RemoteAdminSettings(
  576. [out, retval] INetFwRemoteAdminSettings** remoteAdminSettings
  577. );
  578. // Settings governing ICMP packets.
  579. [id(7), propget]
  580. HRESULT IcmpSettings(
  581. [out, retval] INetFwIcmpSettings** icmpSettings
  582. );
  583. // Returns the collection of globally open ports.
  584. [id(8), propget]
  585. HRESULT GloballyOpenPorts(
  586. [out, retval] INetFwOpenPorts** openPorts
  587. );
  588. // Returns the collection of services.
  589. [id(9), propget]
  590. HRESULT Services(
  591. [out, retval] INetFwServices** services
  592. );
  593. // Returns the collection of authorized apps.
  594. [id(10), propget]
  595. HRESULT AuthorizedApplications(
  596. [out, retval] INetFwAuthorizedApplications** apps
  597. );
  598. }
  599. // Provides access to a firewall policy. Instances of this interface are
  600. // retrieved through the LocalPolicy method of the INetFwMgr interface. All
  601. // configuration changes take effect immediately.
  602. [
  603. object,
  604. uuid(D46D2478-9AC9-4008-9DC7-5563CE5536CC),
  605. dual
  606. ]
  607. interface INetFwPolicy : IDispatch
  608. {
  609. // Returns the profile currently in effect.
  610. [id(1), propget]
  611. HRESULT CurrentProfile(
  612. [out, retval] INetFwProfile** profile
  613. );
  614. // Returns the profile of the requested type.
  615. [id(2)]
  616. HRESULT GetProfileByType(
  617. [in] NET_FW_PROFILE_TYPE profileType,
  618. [out, retval] INetFwProfile** profile
  619. );
  620. }
  621. // Provides access to the firewall settings for a computer. This interface is
  622. // supported by the HNetCfg.FwMgr COM object. All configuration changes take
  623. // effect immediately.
  624. [
  625. object,
  626. uuid(F7898AF5-CAC4-4632-A2EC-DA06E5111AF2),
  627. dual
  628. ]
  629. interface INetFwMgr : IDispatch
  630. {
  631. // Returns the local firewall policy.
  632. [id(1), propget]
  633. HRESULT LocalPolicy(
  634. [out, retval] INetFwPolicy** localPolicy
  635. );
  636. // Returns the type of firewall profile currently in effect.
  637. [id(2), propget]
  638. HRESULT CurrentProfileType(
  639. [out, retval] NET_FW_PROFILE_TYPE* profileType
  640. );
  641. // Restores the local configuration to its default state.
  642. [id(3)]
  643. HRESULT RestoreDefaults();
  644. // Determines whether an application can listen for inbound traffic on the
  645. // specified port.
  646. //
  647. // Parameters:
  648. //
  649. // imageFileName - The image filename of the process listening on the
  650. // network. It must be a fully-qualified path, but it may contain
  651. // environment variables. If 'imageFileName' is NULL, the function
  652. // determines whether the port is allowed for all applications.
  653. //
  654. // ipVersion - IP version of the traffic. If 'localAddress' is non-NULL,
  655. // this must not be NET_FW_IP_VERSION_ANY.
  656. //
  657. // portNumber - Local IP port number of the traffic. If 'portNumber' is
  658. // zero, 'imageFileName' must not be NULL and the function checks if the
  659. // application is allowed to listen on any port.
  660. //
  661. // localAddress - Either a dotted-decimal IPv4 address or an IPv6 hex
  662. // address specifying the local address of the traffic. Typically, this is
  663. // the address passed to bind. If 'localAddress' is NULL, the function
  664. // determines whether the port is allowed for all interfaces.
  665. //
  666. // ipProtocol - IP protocol of the traffic, either NET_FW_IP_PROTOCOL_TCP or
  667. // NET_FW_IP_PROTOCOL_UDP. Ignored if 'portNumber' is zero.
  668. //
  669. // allowed - Returns a VARIANT of type VT_BOOL indicating whether the port
  670. // is allowed for at least some local interfaces and remote addresses.
  671. //
  672. // restricted - Returns a VARIANT of type VT_BOOL indicating whether some
  673. // local interfaces or remote addresses are blocked for this port. For
  674. // example, if the port is restricted to the local subnet only.
  675. //
  676. [id(4)]
  677. HRESULT IsPortAllowed(
  678. [in] BSTR imageFileName,
  679. [in] NET_FW_IP_VERSION ipVersion,
  680. [in] LONG portNumber,
  681. [in] BSTR localAddress,
  682. [in] NET_FW_IP_PROTOCOL ipProtocol,
  683. [out] VARIANT* allowed,
  684. [out] VARIANT* restricted
  685. );
  686. // Determines whether the specified ICMP type is allowed.
  687. [id(5)]
  688. HRESULT IsIcmpTypeAllowed(
  689. [in] NET_FW_IP_VERSION ipVersion,
  690. [in] BSTR localAddress,
  691. [in] BYTE type,
  692. [out] VARIANT* allowed,
  693. [out] VARIANT* restricted
  694. );
  695. }
  696. [
  697. uuid(DB4F3345-3EF8-45ED-B976-25A6D3B81B71),
  698. version(1.0)
  699. ]
  700. library NetFwPublicTypeLib
  701. {
  702. importlib("stdole2.tlb");
  703. interface INetFwRemoteAdminSettings;
  704. interface INetFwIcmpSettings;
  705. interface INetFwOpenPort;
  706. interface INetFwOpenPorts;
  707. interface INetFwService;
  708. interface INetFwServices;
  709. interface INetFwAuthorizedApplication;
  710. interface INetFwAuthorizedApplications;
  711. interface INetFwProfile;
  712. interface INetFwPolicy;
  713. interface INetFwMgr;
  714. [
  715. uuid(0CA545C6-37AD-4A6C-BF92-9F7610067EF5)
  716. ]
  717. coclass NetFwOpenPort
  718. {
  719. [default] interface INetFwOpenPort;
  720. }
  721. [
  722. uuid(EC9846B3-2762-4A6B-A214-6ACB603462D2)
  723. ]
  724. coclass NetFwAuthorizedApplication
  725. {
  726. [default] interface INetFwAuthorizedApplication;
  727. }
  728. [
  729. uuid(304CE942-6E39-40D8-943A-B913C40C9CD4)
  730. ]
  731. coclass NetFwMgr
  732. {
  733. [default] interface INetFwMgr;
  734. }
  735. }