使用 python 确定 dll 是在调试中构建还是在发布中构建
Identify whether a dll is built in debug or release with python
有什么方法可以确定内置于 MS Visual Studio 2005 (C++) 中的 dll 是在调试中还是在发布 中使用 python 编译的?
我知道 VS 能够加载 dll 并向您显示一些元数据存储此信息的清单。 python 模块也能做到吗?
另一种选择是识别此 dll 对其他 dll 的依赖性并查找仅调试的依赖性,例如:msvcr80D.dll,如果可能的话。
Pefile can help you parse PE executable. You can find some usage 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.
有什么方法可以确定内置于 MS Visual Studio 2005 (C++) 中的 dll 是在调试中还是在发布 中使用 python 编译的?
我知道 VS 能够加载 dll 并向您显示一些元数据存储此信息的清单。 python 模块也能做到吗?
另一种选择是识别此 dll 对其他 dll 的依赖性并查找仅调试的依赖性,例如:msvcr80D.dll,如果可能的话。
Pefile can help you parse PE executable. You can find some usage 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.