[英]How to add one imported function to existing Android SO library?
I'm currently developing the SO plugin loader for the existing SO library (GTA SA for Android). 我目前正在为现有的SO库(适用于Android的GTA SA)开发SO插件加载程序。 The SO libraries on Android are Unix ELF files. Android上的SO库是Unix ELF文件。 Having no source code of the library I cannot simply add the imported function in source code and compile the SO library again. 没有该库的源代码,我不能简单地在源代码中添加导入的函数并再次编译SO库。
There is libGTASA.so, which I want to edit and alter the import table, adding a new symbol RunSOpluginLoader, which would be implemented in libFastman92pluginLoader.so, which is already loaded before libGTASA.so gets loaded, by Java code (classes.dex) that I also have modified. 有一个libGTASA.so,我想编辑和更改导入表,添加一个新符号RunSOpluginLoader,该符号将在libFastman92pluginLoader.so中实现,该文件已由Java代码(classes.dex ),我也进行了修改。
For EXE files on Windows there are plenty of programs to edit the imports and I'd use LordPE. 对于Windows上的EXE文件,有很多程序可以编辑导入,我会使用LordPE。 For ELF file I need a different solution however and I'm having a trouble with finding one. 对于ELF文件,我需要一个不同的解决方案,但是在寻找解决方案时遇到了麻烦。
I tried using HT Editor, which is supposed to open and edit the ELF files, but few seconds after libGTASA.so gets opened in HT Editor the application simply crashes. 我尝试使用HT编辑器,它应该打开并编辑ELF文件,但是libGTASA.so在HT编辑器中打开几秒钟后,应用程序便崩溃了。
I need a solution to add an import to SO library, preferably the solution that would run on Windows, but if there's none then I am willing to do it on Linux system. 我需要一个解决方案以将导入添加到SO库,最好是可以在Windows上运行的解决方案,但是如果没有解决方案,那么我愿意在Linux系统上进行。
After properly adding an import I am going to edit a bit of ARM code inside the libGTASA.so to actually call the newly imported function. 正确添加导入后,我将在libGTASA.so中编辑一些ARM代码,以实际调用新导入的函数。
Essentially: 实质上:
libGTASA.so - I want to add an imported symbol RunSOpluginLoader to this file. libGTASA.so-我想将导入的符号RunSOpluginLoader添加到此文件。
Few days after I wrote the question I figured out how to do this task. 在我写了问题的几天后,我就知道了如何完成这项任务。 I had written a simple ELF file manager class in C++ and program, which does the following: 我已经用C ++和程序编写了一个简单的ELF文件管理器类,该类执行以下操作:
If you want to learn more about or get the code, feel free to contact me. 如果您想了解更多信息或获取代码,请随时与我联系。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.