开发者

Is there anyway to get the statically linked functions contained in a .exe and reuse them?

For example:

S开发者_如何学编程ay 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?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜