如何从 OCX 或 TLB 文件获取导入的类型库?

发布于 2024-09-29 00:14:54 字数 414 浏览 0 评论 0原文

我确信没有办法找到 ActiveX 的 COM 依赖项,但令我惊讶的是 OLEVIEW 显示了一些注释,例如:

// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} importlib("stdole2.tlb"); // TLib : Visual Basic 运行时对象和过程 : {EA544A21-C82D-11D1-A3E4-00A0C90AEA82} 导入库(“3”);

我尝试使用 TypeLibInfoFromFile 提取相同的信息,但根据我在 MSDN 中找到的内容,没有 Api 提供此信息。您知道从 OCX 或其 Tlb 文件中提取此信息的方法吗?知道我的所有 ocx 都是用 vb6 编译的,我可以相信导入(明确不在代码中)接口的此信息吗?

I was convinced that there is no way to find COM dependencies of an ActiveX but to my surprise OLEVIEW shows some comments Like:

// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");
// TLib : Visual Basic runtime objects and procedures : {EA544A21-C82D-11D1-A3E4-00A0C90AEA82}
importlib("3");

I tried to extract the same information using TypeLibInfoFromFile but based on what I find in MSDN, there is no Api that provides this information. Are you aware of a method to extract this information from OCX or it's Tlb file? Knowing that all my ocxes are compiled with vb6 can I trust this informaion for Imported(Explicitly not in code) interfaces?

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

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

发布评论

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

评论(1

早乙女 2024-10-06 00:14:54

嗯,我已经找到了这个问题的答案。我将其写在这里以防万一有人会搜索相同的问题。可以找到一些依赖项,但您永远无法确定是否已找到全部依赖项。基本上,您必须枚举每种类型和接口以及每种类型的每个成员,以查找模块中的所有类型,并且对于您找到的每种类型,您应该检查它是否位于外部 TypeLib 中。最后你有一个引用的类型库列表。

此方法的问题在于,您只能找到公共接口中使用的类型(字段、返回值和参数),而错过了每个本地对象或动态创建的对象。也就是说,您可以检查此链接以获取 实现或更好的这个

Well, I've found the answer to this question. I'll write it here just in case someone would search for the same question. It's possible to find some of dependencies but you can never be sure if you have found them all. Basically you must enumerate every type and interface, and every member of each type to find all types in the module and for every type you find you should check to see if it's in an external TypeLib. in the end you have a List of Typelibs referenced.

The problem with this method lays in the fact you find only the types that are used in the public interface (fields, return values and parameters) and you miss every local object or dynamically created ones. That said you can check this link for an implementation or better yet this one.

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