Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Technical Information

Code Hz edited this page Feb 20, 2020 · 1 revision

Implementation details

First of all, since bds does not export any symbols, we cannot directly call its internal functions.

Fortunately, bds provides the pdb file, which contains almost all the required symbols and their relative offsets in the file. If we want to call the functions in it, we can parse the pdb file first, get the offset of the file, and then calculate the position of the symbol in memory.

So there is a solution is to first save all the offsets corresponding to the symbols in pdb to a database file and read it at runtime to achieve the purpose of calling the bds function.

This solution does work, but unfortunately it is too complicated and there is no way to write header files directly. So I thought of another solution, which is to restore the export table from the pdb file. Despite all the difficulties, I finally wrote this converter program. That's it EatPdb project.

With this tool, the development process went smoothly immediately. Since I have a lot of Minecraft related reverse engineering experience, recovering header files is not a difficult task for me.

Of course, I also encountered some inevitable problems in the process. The first is due to the ABI requirements of win32, whose symbols include the method's visibility flag and the virtual function's flag. Then the virtual function call is not used directly according to the symbol, but based on its order in the source code. This means that I either have to write all the virtual functions; or I have to manually load the symbols to force the corresponding functions to be called. But in any case, it is always solved, even if it is more complicated to write