1
我正试图做一个程序来打开另一个程序并阻止它的网络权限,如何使用C#
来做到这一点?
这就像一个防火墙程序。如何运行程序并阻止其Internet使用权限?
我正试图做一个程序来打开另一个程序并阻止它的网络权限,如何使用C#
来做到这一点?
这就像一个防火墙程序。如何运行程序并阻止其Internet使用权限?
链接到firewall API。下面的代码阻止任何传出连接。
INetFwRule fire = (INetFwRule)Activator.CreateInstance(
Type.GetTypeFromProgID("HNetCfg.FWRule"));
fire.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
fire.Description = "Block";
fire.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT;
fire.Enabled = true;
fire.InterfaceTypes = "All";
fire.Name = "Block Internet";
INetFwPolicy2 firePolicy = (INetFwPolicy2)Activator.CreateInstance(
Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
firePolicy.Rules.Add(fire);
入住这link太
感谢它=) – Christopher
你的问题有点不清楚,你能举个例子吗? –
这是一个互联网接入限制...像Sandboxie http://i.stack.imgur.com/Rb6Ul.png – Christopher
欢迎来到StackOverflow!请阅读[如何问](http://stackoverflow.com/help/how-to-ask) –