如何从 COM dll 中的序号获取函数名称
我试图从 COM dll 的序号中获取实际的函数名称。 我尝试使用 dumpbin.exe
但它只为每个序数返回 [NONAME]
(除了前几个)。
ordinal hint RVA name 21 0 00002439 DllCanUnloadNow 25 1 00007F41 DllGetClassObject 116 2 0000539C DllMain 138 3 00008633 DllRegisterServer 176 4 00008640 DllUnregisterServer 1 0009152E [NONAME] 2 00154CA7 [NONAME] 3 00154C0B [NONAME] 4 000140C9 [NONAME] ...
包含 .dll 文件的目录不包含任何其他文件(*.tlb、*.lib、*.def)。
有人可以告诉我如何获得这些列表吗? 或者至少是使用注册表或其他东西的特定序数的名称?
[编辑:附加信息] 我找不到 COM dll 的 .def 文件,因此无法使用它来获取名称。 我对实例化 COM 类不感兴趣,我只想知道什么函数与指定的序数相关。
我最初的问题是我使用 WinDbg 发现了一个异常,该异常发生在 ChartFXClientServerCore!Ordinal5507(+0x97b7),所以我想看看具体的函数来尝试隔离问题。
I am trying to get actual function names from their ordinal numbers from a COM dll. I tried using dumpbin.exe
but it only returns [NONAME]
for each ordinal (except the first few).
ordinal hint RVA name 21 0 00002439 DllCanUnloadNow 25 1 00007F41 DllGetClassObject 116 2 0000539C DllMain 138 3 00008633 DllRegisterServer 176 4 00008640 DllUnregisterServer 1 0009152E [NONAME] 2 00154CA7 [NONAME] 3 00154C0B [NONAME] 4 000140C9 [NONAME] ...
The directory containing the .dll file doesn't contain any other files (*.tlb, *.lib, *.def).
Could someone tell me how to get a list of these?
Or at least the name of a specific ordinal using registry or something?
[EDIT: Additional info]
I cannot find the .def file for the COM dll, so I cannot use it to get the name. I am not interested in instantiating the COM class, I only want to know what function is related to a specified ordinal.
My original problem is that I have found an exception using WinDbg, which happens in
ChartFXClientServerCore!Ordinal5507(+0x97b7), so I would like to see the specific function to try to isolate the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 OleView 工具(OLE/COM 对象查看器),该工具(除其他外)随 Windows SDK 一起提供,http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en 。 在该工具中,转到“文件”->“查看类型库”,然后浏览到您的 DLL。
编辑:针对有关 typelib 公开的 DLL 序数和方法名称之间关系的问题:通过 COM 公开的方法也通过 DEF 文件或通过 __declspec( dll 导入)。 通常,在通过 CoCreateInstance() 或类似方法创建相应的类之后,您可以通过 IUnknown 派生接口访问 COM 方法。
DLL 的程序员也可以选择在 DEF 文件中公开一些 COM 方法,但据我所知,找出映射的唯一方法是查看 dumpbin /exports 的输出,un-装饰返回的名称(使用 undname.exe)并在类型库中直观地找到对应关系。
You can use the OleView tool (OLE/COM Object Viewer), which ships (among others) with the Windows SDK, http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en. In that tool, go to File->View TypeLib and then browse to your DLL.
EDIT: In response to the question about the relationship between DLL ordinals and method names exposed by the typelib: It is not too common for methods exposed via COM to be also exposed via the DEF file or via __declspec(dllimport). Typically you access COM methods via their IUnknown-derived interface, after having created the corresponding class via CoCreateInstance() or similar.
The programmer of the DLL can also choose to expose some of the COM methods in the DEF file, but AFAIK the only way to figure out the mapping is to look at the output of dumpbin /exports, un-decorate the returned names (with undname.exe) and visually find a correspondence in the typelib.
如果您的 COM 组件没有标记为脚本安全,则 OLEView 可能不会有任何真实信息(即它不会从脚本中调用,因此如何调用它的所有信息(typelib)都是通过idl)。
像 mIDA 这样的东西可以为您提供大部分信息。 您还可以在 openrce 中搜索 NDR RPC IDL,也在 woodmann,尝试使用符号查看器。 (RIP fravia)。
If your COM component is not marked safe for scripting, it's likely that OLEView will not have any real information (i.e. it's not ment to be called from a script, so all the info (typelib) for how to call it is compiled in via the idl).
Something like mIDA can get you most of that information. You could also search openrce, for NDR RPC IDL, also on woodmann, try the symbolviewer. (RIP fravia).