Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Security > Unable to set INetFWRule Interfaces property

Reply
Thread Tools Display Modes

Unable to set INetFWRule Interfaces property

 
 
Anant
Guest
Posts: n/a

 
      05-20-2009
Hi,
Apologies if this is not the correct place to post this message.

I want to set firewall rule programmatically on just one Network Interface
card identified by its Guid.

I have the valid guid and i want to assign it to Interfaces property, I
don't get compilation error but during run time i get "Value does not fall
within the expected range."

Here's a piece of my code snippet.

INetFwRule NewFwRule = null;
Type typeFWRule = Type.GetTypeFromProgID("HNetCfg.FWRule");
NewFwRule = (INetFwRule)Activator.CreateInstance(typeFWRule);
Guid = {<<valid Guid of my wireless card>>}
if (NewFwRule != null)
{
NewFwRule.Name = ruleName;
NewFwRule.Description = ruleDesc;
NewFwRule.ApplicationName = applnName;
//NewFwRule.serviceName ="AthHostService";
NewFwRule.Protocol = protocol;
NewFwRule.LocalPorts = localPorts;
NewFwRule.Grouping = ruleGrouping;
NewFwRule.Profiles = CurrentProfilesBitMask;
NewFwRule.Action =
NetFwTypeLib.NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
NewFwRule.Enabled = true;
NewFwRule.InterfaceTypes = "Wireless";
NewFwRule.Interfaces = Guid;//<<<----Exception comes here

//Add the Firewall Rule
if (fwPolicy2 != null)
{
fwPolicy2.Rules.Add(NewFwRule);
}
}

Can anyone pls point out what is the mistake i am doing. Any help will be
greatly appreciated.

Thanks
--
Anant
 
Reply With Quote
 
 
 
 
Junior Member
Join Date: Dec 2010
Posts: 1

 
      12-17-2010
Anant - did you ever solve what the problem here was?
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WZCSAPI/WZC-interfaces in VB.NET Jake Windows Vista Drivers 3 06-10-2006 08:29 PM
usb device with multiple interfaces rhvonlehe Windows Vista Drivers 6 06-02-2006 02:26 AM
network interfaces Venkat Windows Vista Drivers 1 02-14-2005 11:15 AM
Registering Interfaces Ben Geib Windows Vista Drivers 5 07-21-2004 03:52 PM
avstream inf interfaces Mike Erickson Windows Vista Drivers 1 08-08-2003 05:35 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59