hnetcfg.dll throws BadImageFormatException

风格不统一 提交于 2020-01-05 11:06:09

问题


Executing code that references c:\windows\system32\hnetcfg.dll to manage the Windows Firewall from this question, causes a BadImageFormatException as soon as the DLL is loaded.

Opening the 414KB DLL file in NUnit for inspection throws the same exception.

I am running Windows 7. Any solutions?


回答1:


Solved:

...by setting target platform to x86.




回答2:


Is it a 64-bit application trying to reference a 32-bit dll? If so, either get the 64-bit version of the dll or force the application to run in 32-bit using

corflags /32bit+ myApp.exe

Or as you say, just build in 32-bit (x86)



来源:https://stackoverflow.com/questions/4289041/hnetcfg-dll-throws-badimageformatexception

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