Deploying NetFwTypeLib to manage the Windows Firewall

后端 未结 3 1956
死守一世寂寞
死守一世寂寞 2020-12-19 03:27

My Windows service needs to create/remove certain rules from the Windows firewall. For this I interface with NetFwTypeLib in \\system32\\hn

相关标签:
3条回答
  • 2020-12-19 03:58

    What a weird error! The best i can think of is don't rely on the System32 version of the DLL, copy it into your folder and call it from there. From my knowledge, i don't think the DLL should conflict with the different bit computers, but if they do then just obtain a different DLL from a 32 bit computer and have separate downloads for x64 and x86. Good luck!

    EDIT: Also, i have had some trouble with programming in 3.5 or lower in VS2010. Try to get a version of visual c# express 2008 and try with that (usually fixes a lot of errors with downgrading .net versions)

    0 讨论(0)
  • 2020-12-19 04:02

    I had an issue with this same dll when working in Visual Studio 2012. For me the fix was to manually move the interop.NetFwTypeLib.dll into the directory I was working from. This seemed to fix the issue for me. Hope it helps

    0 讨论(0)
  • 2020-12-19 04:13

    NetFwTypeLib object doesn't reside in hnetcfg.dll library on Windows 7 Ultimate. Rather, it resides in FirewallAPI.dll at %system32%\FirewallAPI.dll (eg c:\windows\system32\FirewallAPI.dll).

    using NetFwTypeLib; // Add reference %SystemRoot%\System32\FirewallAPI.dll

    0 讨论(0)
提交回复
热议问题