Delphi-取消BPL中的名称

Delphi-取消BPL中的名称

问题描述:

是否可以在Delphi中解开这样的名称? 如果是这样,我在哪里可以获得更多信息?

Is it possible to unmangle names like these in Delphi? If so, where do I get more information?

在dbrtl100.bpl中找不到某个条目的错误消息示例 我想知道它找不到哪个确切的功能(单元,类,名称,参数等).

Example of an error message where it cannot find a certain entry in the dbrtl100.bpl I want to know which exact function it cannot find (unit, class, name, parameters, etc).

---------------------------
myApp.exe - Entry Point Not Found
---------------------------
The procedure entry point @Dbcommon@GetTableNameFromSQLEx$qqrx17System@WideString25Dbcommon@IDENTIFIEROption could not be located in the dynamic link library dbrtl100.bpl. 
---------------------------
OK   
---------------------------

我知道它是Dbcommon单元中的GetTableNameFromSQLEx方法(我有带有RTL/VCL源的Delphi),但有时我碰到并非所有代码都可用的应用程序(是的,客户应始终购买所有源代码支付第三方的费用,但有时却不行.

I know it is the method GetTableNameFromSQLEx in the Dbcommon unit (I have Delphi with the RTL/VCL sources), but sometimes I bump into apps where not all code is available for (yes, clients should always buy all the source code for 3rd party stuff, but sometimes they don't).

但是请说这是一个示例,我没有代码,也没有接口文件(有人BDE.INT吗?) 它具有哪些参数(即哪个潜在的过载)? 它有什么返回类型?

But say this is an example for which I do not have the code, or only the interface files (BDE.INT anyone?) What parameters does it have (i.e. which potential overload)? What return type does it have?

对于任何Delphi版本,此操作是否相同?

Is this mangling the same for any Delphi version?

-jeroen

编辑1 :

Edit 1:

感谢罗伯·肯尼迪: tdump -e dbrtl100.bpl 可以解决问题.完全不需要 -um :

Thanks to Rob Kennedy: tdump -e dbrtl100.bpl does the trick. No need for -um at all:

C:\WINDOWS\system32>tdump -e dbrtl100.bpl | grep GetTableNameFromSQLEx
File STDIN:
00026050 1385 04AC __fastcall Dbcommon::GetTableNameFromSQLEx(const System::WideString, Dbcommon::IDENTIFIEROption)

编辑2 :

Edit 2:

感谢Tondrej找到了此德国EDN文章(英语Google翻译). 那篇文章非常准确地描述了这种格式,应该可以创建一些Delphi代码来消除这种情况.

Thanks to TOndrej who found this German EDN article (English Google Translation). That article describes the format pretty accurately, and it should be possible to create some Delphi code to unmangle this.

作者提到的网站(和电子邮件)现在已经死了,但是很高兴知道此信息.

Pitty that the website the author mentions (and the email) are now dead, but good to know this info.

-jeroen

Delphi没有提供可以解散函数名称的函数,而且我不知道它在任何地方都有记录. 果壳中的德尔福 提到"tdump 实用程序具有 -um 开关,可使其取消对找到的符号的破坏.我从未尝试过.

There is no function provided with Delphi that will unmangle function names, and I'm not aware of it being documented anywhere. Delphi in a Nutshell mentions that the "tdump" utility has a -um switch to make it unmangle symbols it finds. I've never tried it.


tdump -um -e dbrtl100.bpl

如果这不起作用,那么解散自己看起来就不是一个非常复杂的方案.显然,名称以"@"开头,后跟单元名称和功能名称,并用另一个"@"符号分隔.该函数名称后跟"$ qqrx",然后是参数类型.

If that doesn't work, then it doesn't look like a very complicated scheme to unmangle yourself. Evidently, the name starts with "@" and is followed by the unit name and function name, separated by another "@" sign. That function name is followed by "$qqrx" and then the parameter types.

使用类型名称的字符计数对参数类型进行编码,后跟以前相同的以"@"分隔的格式.

The parameter types are encoded using the character count of the type name followed by the same "@"-delimited format from before.

"$"对于标记函数名的结尾和参数类型的开头是必需的.剩下的奥秘是"qqrx"部分. 发现Tondrej 揭示了这一点. "qqr"表示调用约定,在这种情况下为 register ,又称为 fastcall . "x"适用于该参数,表示它是常量.

The "$" is necessary to mark the end of the function name and the start of the parameter types. The remaining mystery is the "qqrx" part. That's revealed by the article Tondrej found. The "qqr" indicates the calling convention, which in this case is register, a.k.a. fastcall. The "x" applies to the parameter and means that it's constant.

返回类型不需要在错误的函数名称中进行编码,因为重载始终不考虑返回类型.

The return type doesn't need to be encoded in the mangled function name because overloading doesn't consider return types anyway.