为什么 TH32CS_SNAPMODULE32 不能单独工作? [英] Why does TH32CS_SNAPMODULE32 doesn't work alone?
问题描述
我在 WinAPI 中试验了一些东西.我的操作系统是 Win7 x64 P1 Ultimate.当我试图列出一个进程的所有模块时,我发现我想要的模块是一个 32 位模块,所以我替换了
I was experimenting with some stuff in WinAPI. My OS is Win7 x64 P1 Ultimate. When I was trying to list all modules of a process I found out that the module that I wanted is a 32-bit module so I replaced
TH32CS_SNAPMODULE
与
TH32CS_SNAPMODULE32
此后没有显示任何模块.所以我决定尝试使用按位运算符,看起来就像我发送这样的参数
After this no module was shown. So I decided to try using bitwise operators and looks like if I send the arguments like this
TH32CS_SNAPMODULE32 | TH32CS_SNAPMODULE
它工作得很好,列出了所有 64 位和 32 位模块.所以我的问题是为什么它不能单独工作?甚至文档也说它可以与TH32CS_SNAPMODULE
一起使用.
It works perfectly fine, listing all 64bit and 32bit modules. So my question here is why it doesn't work alone? Even the docs say it can be used with TH32CS_SNAPMODULE
.
引用自 MSDN
TH32CS_SNAPMODULE32
TH32CS_SNAPMODULE32
当从 64 位进程调用时,包括快照中 th32ProcessID 中指定的进程的所有 32 位模块.该标志可以与 TH32CS_SNAPMODULE 或 TH32CS_SNAPALL 结合使用.如果函数失败并显示 ERROR_BAD_LENGTH,请重试该函数直到成功.
Includes all 32-bit modules of the process specified in th32ProcessID in the snapshot when called from a 64-bit process. This flag can be combined with TH32CS_SNAPMODULE or TH32CS_SNAPALL. If the function fails with ERROR_BAD_LENGTH, retry the function until it succeeds.
推荐答案
文档确实令人困惑.它的意思是说TH32CS_SNAPMODULE32
标志必须与另一个标志组合,但只能与TH32CS_SNAPMODULE组合code> 或
TH32CS_SNAPALL
.
The documentation is admittedly confusing. What it meant to say is that the TH32CS_SNAPMODULE32
flag must be combined with another flag, but can only be combined with TH32CS_SNAPMODULE
or TH32CS_SNAPALL
.
在这个官方答案中只是稍微好一点TH32CS_SNAPMODULE 与 TH32CS_SNAPMODULE32 - 请注意额外":
It's only slightly better phrased in this official answer TH32CS_SNAPMODULE vs TH32CS_SNAPMODULE32 - note the "extra":
根据开发团队的反馈,TH32CS_SNAPMODULE 将为您提供原生模块.您可以 OR TH32CS_SNAPMODULE32 与TH32CS_SNAPMODULE 在 64 位机器上也可以获得 32 位模块.它存在以表明您想要额外 32 位模块状态.
Based on the feedback from the developer team, TH32CS_SNAPMODULE will provide you native modules. You can OR TH32CS_SNAPMODULE32 with TH32CS_SNAPMODULE to get 32-bit modules also when on a 64-bit box. It exists to indicate that you want the extra 32-bit module state.
这篇关于为什么 TH32CS_SNAPMODULE32 不能单独工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!