Windows – 如何从32位WOW进程中的64位进程中枚举模块

我需要在Windows中的32位WOW进程中检索64位进程的所有模块,EnumProcessModules将按照描述进行失败:

If this function is called from a 32-bit application running on WOW64,it can only enumerate the modules of a 32-bit process. If the process is a 64-bit process,this function fails and the last error code is ERROR_PARTIAL_copY (299).

所以对于EnumProcessModulesEx和Createtoolhelp32Snapshot.

你有什么想法如何实现吗?

谢谢.

没有进入未记录的API,你不能这样做.一般来说,由于地址空间差异,从32位进程读取64位进程的内存将无法正常工作.

具有LIST_MODULES_32BIT和LIST_MODULES_64BIT过滤器标志的EnumProcessModulesEx有这样的说法:

This function is intended primarily for 64-bit applications. If the function is called by a 32-bit application running under WOW64,the dwFilterFlag option is ignored and the function provides the same results as the EnumProcessModules function.

您可以通过将程序转换为64位,使用不合格的64位COM服务器(特别是使用DLL surrogate)或与您进行通信的单独进程来实现.或者,根据您的进程相对于目标进程何时启动,您可以使用WMI获取模块加载事件.参见Win32_ModuleLoadTrace事件.

Process Explorer,一个32位的exe,可以显示32位和64位进程的模块,但它真的是冒烟和镜像:32位exe包含64位版本的本身,写入磁盘和在64位机器上执行.

相关文章

Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...
Windows文件操作基础代码 Windows下对文件进行操作使用的一段...
Winpcap基础代码 使用Winpcap进行网络数据的截获和发送都需要...
使用vbs脚本进行批量编码转换 最近需要使用SourceInsight查看...