有什么方法可以确定在 MS Visual Studio 2005 (C++) 中构建的 dll 是在调试中编译还是在发布时使用 python 编译?
我知道 VS 能够加载 dll 并向您显示一些元数据存储此信息的 list 。任何 python 模块也能做到这一点吗?
另一种选择是确定此 dll 对其他 dll 的依赖性并查找仅调试的依赖性,例如:msvcr80D.dll,如果可能的话。
最佳答案
Pefile可以帮你解析PE可执行。你可以找到一些用法 examples在项目页面上。
关于你问题的第二部分,你可以做这样的事情来检索 dll 的依赖项列表(取自示例):
import pefile
path_to_dll = r"path_to_your_dll"
pe = pefile.PE(path_to_dll, fast_load=True)
# If the PE file was loaded using the fast_load=True argument, we will need to parse the data directories:
pe.parse_data_directories()
for entry in pe.DIRECTORY_ENTRY_IMPORT:
print entry.dll
在我的例子中,我得到了以下输出: KERNEL32.dll, MSVCP80D.dll, MSVCR80D.dll, ADVAPI32.dll.
关于python - 确定一个 dll 是在调试中构建的还是使用 python 发布的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35695558/