开发者

print the code of a function in a DLL

开发者 https://www.devze.com 2023-02-25 11:14 出处:网络
I want to print the code of a function in a DLL. I loaded t开发者_Python百科he dll, I have the name of the desired function, what\'s next?

I want to print the code of a function in a DLL.

I loaded t开发者_Python百科he dll, I have the name of the desired function, what's next?

Thank you!


Realistically, next is getting the code. What you have in the DLL is object code -- binary code in the form ready for the processor to execute, not ready to be printed.

You can disassemble what's in the DLL. If you're comfortable working with assembly language, that may be useful, but it's definitely not the original source code (nor probably anything very close to it either). If you want to disassemble it, loading it in your program isn't (usually) a very good starting point. Try opening a VS command line and using dumpbin /disasm yourfile.dll. Be prepared for a lot of output unless the DLL in question is really tiny.


Your only option to retrieve hints about the actual implemented functionality of said function inside the DLL is to reverse engineer whatever the binary representation of assembly happens to be. What this means is that you pretty much have to use a disassembler(IDA Pro, or debugger, e.g. OllyDbg) to translate the opcodes to actual assembly mnemonics and then just work your way through it and try to understand the details of how it functions.

Note, that since it is compiled from C/C++ there is lots and lots of data lost in the process due to optimization and the nature of the process; the resulting assembly can(and probably will) seem cryptic and senseless, but it still does it's job the exact same way as the programmer programmed it in higher level language. It won't be easy. It will take time. You will need luck and nerves. But it IS doable. :)


Nothing. A DLL is compiled binary code; you can't get the source just by downloading it and knowing the name of the function.

If this was a .NET assembly, you might be able to get the source using reflection. However, you mentioned C++, so this is doubtful.


Check out this http://www.cprogramming.com/challenges/solutions/self_print.html and this Program that prints its own code? and this http://en.wikipedia.org/wiki/Quine_%28computing%29

I am not sure if it will do what you want, but i guess it may help you.

0

精彩评论

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