在 DLL 中转发导出函数的问题
你好 我正在将 DLL 的导出函数转发到 DLL 中的另一个函数。我使用 ExpX64 来编辑 DLL 的导出表。 (例如,我将 ?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z 转发到 myDLL.?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z )
我的问题是我的目标函数是类的成员,并且在运行时转发生成 COMException(“试图使用已不复存在的对象”)
您认为我做错了什么? (调用约定?转发常规函数和类成员函数之间应该有区别。) 我是这样实现MyFunc的:
__declspec(dllexport) LONG MyClass::MyFunc (long a,struct MyStruct& b)
ps:我也可以使用DLL代理(创建一个实现我想要的目标函数的代理DLL,并将所有其他函数转发到原始DLL,但是我的函数是类的一部分的问题,仍然仍然)
谢谢
Hi
I am forwarding an exported function of a DLL to another function in my DLL. I use ExpX64 for editing the export table of the DLL.
(for example I forward the ?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z to myDLL.?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z)
My problem is that my target function is a member of a class and in runtime, forwarding that generates a COMException ("attempted to use an object that has ceased to exist")
What do you think I'm doing wrong? (Calling conventions? And there should be a difference between forwarding a regular function and a class-member one.)
I implement MyFunc like this:
__declspec(dllexport) LONG MyClass::MyFunc (long a,struct MyStruct& b)
ps: I can also use a DLL proxy (create a proxy DLL that implements the target function I want and forward all other functions to the original DLL, but the problem that my function is part of a class, still remains)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑您收到的错误与转发有任何关系。错误是 STG_E_REVERTED,这与结构化存储有关(您的方法似乎与结构化存储完全无关)。该错误在 SharePoint 应用程序中显然特别频繁。
编辑:结构化存储 是用于 COM 中持久性的 Microsoft API。
I doubt that the error you get has to do anything with the forwarding. The error is STG_E_REVERTED, and that is related to structured storage (which your method appears to be completely unrelated to). The error is apparently particularly frequent in SharePoint applications.
Edit: Structured Storage is a Microsoft API for persistence in COM.