internal void AddPort(string strName, int Port, NetFwTypeLib.NET_FW_SCOPE_ Scope, NetFwTypeLib.NET_FW_IP_PROTOCOL_ Protocol, string remoteAddresses) { INetFwOpenPort fireWallPort = (INetFwOpenPort)Activator.CreateInstance( Type.GetTypeFromProgID("HNetCfg.FWOpenPort")); fireWallPort.RemoteAddresses = remoteAddresses; fireWallPort.Enabled = true; fireWallPort.Name = strName; fireWallPort.Port = Port; fireWallPort.Protocol = Protocol; firewallManager.LocalPolicy.CurrentProfile .GloballyOpenPorts.Add(fireWallPort); }
internal void RemovePort(int Port, NetFwTypeLib.NET_FW_IP_PROTOCOL_ Protocol) { firewallManager.LocalPolicy.CurrentProfile .GloballyOpenPorts.Remove(Port, Protocol); }