C++,枚举加载的模块时找不到加载的 C# DLL
感谢您花时间阅读本文。
情况基本上是,我使用 EnumProcessModulesEx 枚举已加载进程中的所有模块。我已经验证通过 GetCurrentProcess 获得的进程是正确的(通过 ID)。我似乎获得了除我想要的模块之外的所有已加载模块!它是一个 C# DLL,仅在调用 C# DLL 函数时才加载。在运行枚举函数之前,我确保 DLL 已加载。这个 C# DLL 不显示有什么原因吗?
在我的 C++ 代码中加载几个其他 C# DLL 之后,我还放置了此枚举。似乎也没有找到这些。所有这些 C# DLL 都是动态加载的。我认为这并不重要,因为 a) 无论如何,所有内容都映射到进程地址空间,b) 我有一个注入的 C++ DLL(动态加载?),我可以发现它很好。我的目标是能够挂钩 C# DLL 函数,因此能够找到这些 C# DLL 是这个项目中必须的。
再次感谢大家的任何提示或见解! =)
thank you for taking the time to read this.
The situation is basically, I'm using EnumProcessModulesEx to enumerate all the modules in a loaded process. I've verified that the process I'm getting with GetCurrentProcess is correct (via the ID). I seem to be getting all the loaded modules except the one I want! It's a C# DLL that is only loaded when the C# DLL function is called. I made sure the DLL was loaded before I ran the enumerating function. Is there a reason this C# DLL won't show up?
I also put this enumeration after I load a couple of other C# DLLs in my C++ code. It doesn't seem to be finding those either. All of these C# DLLs are dynamically loaded. I figure it shouldn't matter because a) everything is mapped into the process address space anyways, and b) I have a C++ DLL that is injected (dynamically loaded?) and I can find that just fine. My goal is to be able to hook a C# DLL function, so being able to find these C# DLLs is a must in this project.
Thank you all again for any tips or insights! =)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
EnumProcessModulesEx
不会枚举 .Net DLL。它仅枚举本机 DLL。您可以使用当前
AppDomain
的GetAssemblies
方法来枚举.Net DLL。EnumProcessModulesEx
will not enumerate .Net DLLs. It only enumerates native DLLs.You can use the
GetAssemblies
method of the currentAppDomain
to enumerate .Net DLLs.