INetFwRule interface
The INetFwRule interface provides access to the properties of a rule.
Members
The INetFwRule interface inherits from the IDispatch interface. INetFwRule also has these types of members:
Methods
The INetFwRule interface has these methods.
| Method | Description |
|---|---|
| get_Action |
Retrieves the Action property for this rule. |
| get_ApplicationName |
Retrieves the contents of the ApplicationName property. |
| get_Description |
Retrieves the contents of the Description property for this rule. |
| get_Direction |
Retrieves the Direction property for this rule. |
| get_EdgeTraversal |
Retrieves the EdgeTraversal property for this rule. |
| get_Enabled |
Retrieves the Enabled property for this rule. |
| get_Grouping |
Retrieves the Grouping property for this rule. |
| get_IcmpTypesAndCodes |
Retrieves the IcmpTypesAndCodes property for this rule. |
| get_Interfaces |
Retrieves the Interfaces property for this rule. |
| get_InterfaceTypes |
Retrieves the InterfaceTypes property for this rule. |
| get_LocalAddresses |
Retrieves the LocalAddresses property for this rule. |
| get_LocalPorts |
Retrieves the LocalPorts property for this rule. |
| get_Name |
Retrieves the contents of the Name property for this rule. |
| get_Profiles |
Retrieves the Profiles property for this rule. |
| get_Protocol |
Retrieves the Protocol property for this rule. |
| get_RemoteAddresses |
Retrieves the RemoteAddresses property for this rule. |
| get_RemotePorts |
Retrieves the RemotePorts property for this rule. |
| get_ServiceName |
Retrieves the contents of the ServiceName property. |
| put_Action |
Sets the Action property for this rule. |
| put_ApplicationName |
Sets the name of the ApplicationName property. |
| put_Description |
Sets the contents of the Description property for this rule. |
| put_Direction |
Sets the Direction property for this rule. |
| put_EdgeTraversal |
Sets the EdgeTraversal property for this rule. |
| put_Enabled |
Sets the Enabled property for this rule. |
| put_Grouping |
Sets the Grouping property for this rule. |
| put_IcmpTypesAndCodes |
Sets the IcmpTypesAndCodes property for this rule. |
| put_Interfaces |
Sets the Interfaces property for this rule. |
| put_InterfaceTypes |
Sets the InterfaceTypes property for this rule. |
| put_LocalAddresses |
Sets the LocalAddresses property for this rule. |
| put_LocalPorts |
Sets the LocalPorts property for this rule. |
| put_Name |
Sets the contents of the Name property for this rule. |
| put_Profiles |
Sets the Profiles property for this rule. |
| put_Protocol |
Sets the Protocol property for this rule. |
| put_RemoteAddresses |
Sets the RemoteAddresses property for this rule. |
| put_RemotePorts |
Sets the RemotePorts property for this rule. |
| put_ServiceName |
Sets the contents of the ServiceName property. |
Properties
The INetFwRule interface has these properties.
| Property | Description |
|---|---|
|
Accesses the Action property of this rule. | |
|
Accesses the ApplicationName property for this rule. | |
|
Accesses the Description property for this rule. | |
|
Accesses the Direction property for this rule. | |
|
Accesses the EdgeTraversal property for this rule. | |
|
Accesses the Enabled property for this rule. | |
|
Accesses the Grouping property for this rule. | |
|
Accesses the IcmpTypesAndCodes property for this rule. | |
|
Accesses the Interfaces property for this rule. | |
|
Accesses the InterfaceTypes property for this rule. | |
|
Accesses the LocalAddresses property for this rule. | |
|
Accesses the LocalPorts property of this rule. | |
|
Accesses the Name property for this rule. | |
|
Accesses the Profiles property for this rule. | |
|
Accesses the Protocol property for this rule. | |
|
Accesses the RemoteAddresses property of this rule. | |
|
Accesses the RemotePorts property for this rule. | |
|
Accesses the ServiceName property for this rule. |
Remarks
Each time you change a property of a rule, Windows Firewall commits the rule and verifies it for correctness. As a result, when you edit a rule, you must perform the steps in a specific order. For example, if you add an ICMP rule, you must first set the protocol to ICMP, then add the rule. If these steps are taken in the opposite order, an error occurs and the change is lost. If you are editing a TCP port rule and converting it into an ICMP rule, first delete the port, change protocol from TCP to ICMP, and then add the rule.
In order to retrieve and modify existing rules, instances of this interface must be retrieved through INetFwRules. All configuration changes take place immediately.
When accessing the properties of a rule, keep in mind that there may be a small time lag before a newly-added rule is applied.
Properties are used to create firewall rules. Many of the properties can be used in order to create very specific firewall rules.
| Property | Type and format | Constraints |
|---|---|---|
| Name | Clear text string. | Required. The string must not contain a "|" and it must not be "all". |
| Description | Clear text string. | Optional. The string must not contain a "|". |
| Grouping | String in the format "@<dll name>, <resource string identifier>". | Required. |
| Enabled | Boolean (VARIANT_BOOLEAN). | Optional. Defaults to false (VARIANT_FALSE) if nothing is specified. |
| ApplicationName | Clear text string. | Optional. |
| ServiceName | Clear text string. | Optional. |
| LocalPorts | Clear text string containing a list of port numbers. "RPC" is an acceptable value. | Optional. |
| RemotePorts | Clear text string containing a list of port numbers. | Optional. |
| LocalAddresses | Clear text string containing a list of IPv4 and IPv6 addresses separated by commas. Range values and"*"are acceptable in this list. | Optional. |
| RemoteAddresses | Clear text string containing a list of IPv4 and IPv6 addresses separated by commas. Range values and"*"are acceptable in this list. | Optional. |
| Protocol | Number. | Optional. |
| put_Profiles | String value in the format "type, code". Multiple types and codes can be included in the string by separating each pair with a ";". | Optional. |
| Interfaces | Array of strings containing the friendly names of interfaces. | Optional. |
| InterfaceTypes | String value. Multiple interface types can be included in the string by separating each value with a ",". Acceptable values are "RemoteAccess", "Wireless", "Lan", and "All". | Optional. |
| Direction | Enumeration. | Optional. |
| Action | Enumeration. | Optional. |
| EdgeTraversal | Boolean (VARIANT_BOOLEAN). | Optional. |
| Profiles | Enumeration. | Optional. |
For additional information on each property, please see the corresponding topic.
Requirements
|
Minimum supported client | Windows Vista [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2008 [desktop apps only] |
|
Header |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 10/26/2012