哪个进程创建了我的 DLL 进程?

发布于 2024-12-10 02:20:10 字数 128 浏览 0 评论 0原文

我正在将第三方应用程序与我的 DLL 集成。每次运行第三方软件时,都会多次创建和销毁 DLL。

从我的 DLL 中,我需要识别它是否是同一个第三方运行的,或者是不同的第三方运行的。有没有办法识别第三方软件的哪个进程正在创建我?

I am integrating a third party's application with my DLL. The DLL is created and destroyed several times per each run of the third party's software.

From my DLL, I need to recognize if it is the same third party's run or a different one that is creating me. Is there a way to recognize which process of the third party software is creating me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最好是你 2024-12-17 02:20:10

如果每次都卸载 DLL,那么每次加载之间可能需要某种持久存储。如果调用应用程序不提供此信息,则 DLL 本身将需要执行此操作。

一种可能是使用 命名共享内存。如果它不存在,请创建它,然后使用它作为“标志”来知道它在同一个执行中被再次调用。当进程退出时,它将被销毁。当然,这需要考虑安全隐患。另一个进程可能会创建该共享内存,使您的 DLL“认为”它在同一次运行中被再次调用,而实际上它是第一次调用。

If the DLL is being unloaded each time, then it will likely need some kind of persistent storage between each time it is loaded. If the calling application does not provide this information, then the DLL itself will need to perform that.

One possibility might be to use named shared memory. If it does not exist, create it and then use that as the "flag" to know that it is being called again in the same execution. When the process exits, it will be destroyed. There are, of course, security implications with this that would need to be considered. Another process could potentially create that shared memory to make your DLL "think" that it was being called again in the same run when it was actually the first invocation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文