是否有办法获取 .exe 中包含的静态链接函数并重用它们?
例如:
假设我已将 myprogram.obj
与 myprogram.lib
链接以生成 myprogam.exe
如果 myprogram.lib
> 其中包含各种特殊函数,而我不小心删除了它(以及源代码),有没有办法可以深入挖掘 myprogram.exe
并获取这些函数?或者甚至可能只是以某种方式将 myprogram.exe 转换为 .lib 文件并且仅引用我需要的部分?
For example:
Say I have linked myprogram.obj
with myprogram.lib
to make myprogam.exe
If myprogram.lib
had all sorts of special functions contained in it, and I had accidentally deleted it (and the source), is there a way I could dig into myprogram.exe
and get the functions out? Or maybe even just convert myprogram.exe
to a .lib
file somehow and only reference the parts of it i need?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
所以事情是这样的。您可能可以“反编译”您的可执行文件。很痛苦。但如果您想了解有关此事的所有信息,请查看 这个是较早的问题。
So here's the thing. You probably can "decompile" your executable file. It's a pain. But if you would like all the information you could want on this matter, take a look at this earlier SO question.
大多数编译器通过删除未使用的函数来优化代码。除非您使用了库的每个部分,或者您小心地设置了编译器,以便它不会优化掉未使用的函数,否则您的 lib 文件完全包含在可执行文件中的可能性不大。
most compilers optimize the code by removing unused functions. unless you were using every piece of the library, or you took care to set the compiler so that it does not optimize away unused functions, there is not much chance that your lib file is included in its entirety into the executable.
功能都在里面。如果 exe 未加密或无法反汇编为直接汇编代码(exepackers、加密、加密狗),您可以找到这些函数。
但它们的命名、确切的边界和其他注释都消失了,这使得很难自动化执行此操作,因为不再有任何东西可以识别这些函数。
换句话说,这是汇编向导或专业逆向工程服务的东西。
如果您的代码非常有价值,并且您的编译器相对常见,那么逆向工程服务可能会为您做到这一点。但要做好付出高昂代价的准备。即使只是分析它的容易程度也可能是昂贵的。 (*)
在大多数情况下,提取的成本(无论是您自己的时间,还是雇用的)比函数的价值更大,并且重写它们更便宜
(*) RTTI 或内部调试信息可能会更容易。
The functions are in there. If the exe is not encrypted or otherwise cannot be disassembled to straight assembler code (exepackers, encryption, dongles), you could find the functions.
But their naming, and exact bounderies and other annotations are gone, which makes it hard to do this automated, since there is nothing to identify the functions anymore.
In other words this is something for an assembler wizard or for professional reverse engineering services.
If your code is very valuable, and your compiler relatively common, there are reverse engineering services that might do it for you. But be prepared for a hefty price. Even just analysis of how easy it will be might be expensive. (*)
In most situations, the price of extraction (either your own time, or hired) is bigger than the worth of the functions, and it is cheaper to rewrite them
(*) RTTI or internal debug info might make it easier.