我需要调用一个 dll,该 dll 在一个应用程序中重复调用 5 个其他 dll
我目前正在 C++ 应用程序中使用 SQLitening (www.sqlitening.com),我在其中调用 SQLitening.dll。 SQLitening.dll 随后调用 SQLiteningClient.dll、Zlib.dll 和 SQLite3.dll。我显式挂接 SQLitening.dll,执行一些函数,然后关闭连接并使用 FreeLibrary 取消引用 dll。
但是,后续 dll(SQLiteningClient.dll 等)仍然挂接到调用进程。每当我尝试再次挂钩 SQLitening.dll 时,它都可以正常挂钩,但某些函数行为不正常,例如查询远程数据库的函数。我不禁认为这是因为这些 dll 没有被正确释放。每当我隐式挂钩 dll(全局挂钩每个函数)时,只要我一直将其保留在内存中,一切都会正常工作。但是,我需要明确地这样做。
注意:SQLitening 的 Fred Meier 表示,显式链接在 PowerBasic 应用程序中工作得很好。我还应该注意到 SQLitening 是用 PowerBasic 编写的。
有没有办法为 SQLitening.dll 生成一个单独的进程或线程来挂钩所有内容,以便当我取消引用 SQLitening 时我可以杀死该进程?或者是否有一种特殊的方法来确保 SQLitening 调用的所有内容都被正确取消引用?谢谢。
-马特·菲尔普斯
-解析系统
I'm currently using SQLitening (www.sqlitening.com) in a C++ application where I'm calling SQLitening.dll. SQLitening.dll makes subsequent calls to SQLiteningClient.dll, Zlib.dll and SQLite3.dll. I am hooking SQLitening.dll explicitly, executing a few functions, and then I am closing the connection and dereferencing the dll with FreeLibrary.
However, the subsequent dlls (SQLiteningClient.dll, etc) are remaining hooked to the calling process. Whenever I try to hook SQLitening.dll again, it hooks fine, but some of the functions misbehave, such as the function to query the remote database. I can't help but think this is because those dlls aren't being free'd properly. Whenever I had hooked the dll implicitly (hooking each function globally), everything worked fine as long as I kept it in memory the whole time. However, I need to do this explicitly.
Note: Fred Meier of SQLitening said that explicit linking worked fine in a PowerBasic application. I should also note that SQLitening was written in PowerBasic.
Is there any way to spawn a separate process or thread for SQLitening.dll to hook everything to, so that when I dereference SQLitening I can just kill that process? Or is there a special way to make sure that everything that SQLitening calls is being dereferenced properly? Thanks.
-Matt Phelps
-Resolution Systems
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过使用显式加载 dll 的 COM exe 解决了这个问题。
I solved the issue by just using a COM exe that loads the dll explicitly.
只需取消钩子或在钩子之前检查函数是否已被钩子即可。
Just unhook your hooks or check if function is already hooked before hook it.