更改COM DLL的接口指南(资源补丁)

发布于 2024-08-24 08:10:00 字数 105 浏览 5 评论 0原文

我必须构建 COM 库 (DLL) 的 OEM 版本。 有谁知道一个工具(资源黑客)可以在构建时间后替换我的一些界面指南?

我只想构建并测试一个 DLL,然后生成 OEM 版本。

I have to build OEM versions of a COM library (DLL).
Does anyone know a tool (ressource hacker) which may replace some of my interface guids after build time?

I just want to build and test one DLL and generate the OEM versions afterwards.

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

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

发布评论

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

评论(2

童话 2024-08-31 08:10:00

据我所知没有工具。您可以使用自动构建过程来实际构建具有不同 GUID 的 dll#。

No tool that I know of. You could use an automated build process to actually build dll#s with different GUID's.

只是偏爱你 2024-08-31 08:10:00

替换已编译的二进制文件中的接口 ID 并不那么容易。它们通常是硬编码的,编译器将它们分配在静态存储中,它们甚至可能具有静态链接,因此您在查找它们时会遇到问题。还记得QueryInterface()通常是如何实现的吗?

HRESULT CImpl::QueryInterface( IID& iid, void** result )
{
    if( iid == __uuidof( IInterfaceThisClassImplements1 ) ) {
       *result = static_cast<IInterfaceThisClassImplements1*>( this );
    } else {
       ///same stuff for other interfaces
    }
    //call AddRef() if succeeded
}

它不仅限于资源编辑,您必须实际修补二进制图像的静态数据,并且可能没有工具能够自动为您执行此操作。

由于您拥有完整的源代码,因此最好的选择就是重建二进制文件。

Replacing interface ids in the compiled binary is not that easy. They are usually hardcoded and the compiler allocates them in static storage and they might even have static linkage so you will have problems finding them. Remember how QueryInterface() is usually implemented?

HRESULT CImpl::QueryInterface( IID& iid, void** result )
{
    if( iid == __uuidof( IInterfaceThisClassImplements1 ) ) {
       *result = static_cast<IInterfaceThisClassImplements1*>( this );
    } else {
       ///same stuff for other interfaces
    }
    //call AddRef() if succeeded
}

It's not limited to resource editing, you have to actually patch the static data of the binary image and likely no tool will be able to do this automatically for you.

Since you have the full source your best bet is to just rebuild the binary.

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