Delphi - rename names in BPL

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

An example error message in which he cannot find a specific entry in dbrtl100.bpl I want to know what exact function he 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 --------------------------- 

I know that this is the GetTableNameFromSQLEx method in the Dbcommon module (I have Delphi with RTL / VCL sources), but sometimes I come across applications in which not all code is available (yes, clients should always buy all the source code for third-party things, but sometimes they don’t).

But tell me, this is an example for which I have no code or just interface files (is anyone BDE.INT?) What parameters does it have (i.e. What is the potential overload)? What type of return does it have?

Is this the same for any version of Delphi?

- Jeroen

Change 1 :

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

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

Edit 2 :

Thanks to Todrej, who found this German article EDN ( English translation by Google ). This article describes the format fairly accurately, and it should be possible to create some Delphi code to unleash it.

Pitti, that the site the author mentions to (and email) is now dead, but it's good to know this information.

- Jeroen

+7
delphi name-mangling bpl
source share
4 answers

There is no function provided with Delphi that will unravel function names, and I do not know that it is documented anywhere. Delphi briefly mentions that the "tdump" utility has the -um switch so that it does not display the characters it finds. I have never tried.

 tdump -um -e dbrtl100.bpl

If this does not work, then it does not look like a very complex scheme to untie yourself. Apparently, the name starts with "@", followed by the name and the name of the function, separated by the "@" sign. This function name is followed by "$ qqrx", followed by the parameter types.

Parameter types are encoded using the character number of the type name, followed by the previous format with the @ separator.

The value "$" is necessary to indicate the end of a function name and the beginning of parameter types. The remaining mystery is part of qqrx. This is revealed in an article by Tondrei. "Qqr" indicates the calling convention, which in this case is a register, fast.all.ka "X" refers to the parameter and means that it is constant.

The return type does not have to be encoded in the function name mangled, because overloading does not consider return types in any case.

+7
source share

Also see this article (in German). I assume that manipulation is probably compatible with feedback, and new versions of Delphi introduce new control schemes for new language features.

+7
source share

If you have C ++ Builder, check $ (BDS) \ source \ cpprtl \ Source \ misc \ unmangle.c - it contains the source code for the unmangling mechanism used by TDUMP, the debugger, and the linker. (C ++ Builder and Delphi use the same switching scheme.)

+6
source share

From the Delphi 2007 source files:

 function GetTableNameFromSQLEx(const SQL: WideString; IdOption: IDENTIFIEROption): WideString; 

This is similar to the same version as I also have the same .BPL in my Windows \ System32 folder.

The source can be found in the [Program Files] \ CodeGear \ RAD Studio \ 5.0 \ source \ Win32 \ db folders

Borland / Codegear / Embarcadero has been using this encoding for a long time and has never given much details about the .BPL format. I have never been interested in them because I hate using runtime libraries in my projects. I prefer to compile them into my projects, although this will lead to significantly more executable files.

0
source share

All Articles