A Windows Vista forum. Vista Banter

Welcome to Vista Banter.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to ask questions and reply to others posts, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Go Back   Home » Vista Banter forum » Microsoft Windows Vista » Security and Windows Vista
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Security and Windows Vista A forum for discussion on security issues with Windows Vista. (microsoft.public.windows.vista.security)

Unable to set INetFWRule Interfaces property



 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old May 20th 09, 01:40 PM posted to microsoft.public.windows.vista.security
Anant
external usenet poster
 
Posts: 1
Default Unable to set INetFWRule Interfaces property

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
 




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

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



All times are GMT. The time now is 04:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Optimization by vBSEO 3.0.0 RC6
Copyright ©2004-2024 Vista Banter.
The comments are property of their posters.