C# Firewall not working at Windows 7

孤街醉人 提交于 2020-01-16 16:25:23

问题


Presently I am working in a Firewall project. First I downloaded a Firewall project from codeproject http://www.codeproject.com/KB/cpp/firewallpapi.aspx which was in C++. So I made a dll from that code and called it from C# project. Its working perfectly . But in Windows 7 it is not working. Can anyone give me any hint, why it is not working at windows 7.

Thanks.


回答1:


Perhaps because the API has changed:

"By providing a simpler development platform, Windows Filtering Platform is designed to replace previous packet filtering technologies such as Transport Driver Interface (TDI) filters, Network Driver Interface Specification (NDIS) filters, and Winsock Layered Service Providers (LSP). Starting in Windows Server 2008 and Windows Vista, the firewall hook and the filter hook drivers are not available; applications that were using these drivers should use Windows Filtering Platform instead."




回答2:


Compile it for Windows 7 (32/ 64 Bit).

Check Event Viewer for any permission denied exception internally by windows.




回答3:


It is possible to require elevation (User Account Control) but the app does not have a proper manifest so the elevation window never shos up.

Try Right Click -> Run As Admin and see if it works then.




回答4:


@Stuart Dunkeld I found a solution in Codeproject. http://www.codeproject.com/KB/IP/PacketFilter.aspx



来源:https://stackoverflow.com/questions/4105806/c-sharp-firewall-not-working-at-windows-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!