⇤ ← Revision 1 as of 2006-12-17 12:10:18
Size: 470
Comment:
|
Size: 1021
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 9: | Line 9: |
During the work on my school's final work I had to "steal" some functionality from binary-only Windows DLLs which were unfortunately written in C++ (object-oriented). Since there is no real standard in how methods/classes should be exported I've found myself in quite hopeless situation. | During the work on my school's final work I had to "steal" some functionality from binary-only Windows DLLs which were unfortunately written in C++ (object-oriented). Since there is no real standard in how methods/classes should be exported I've found myself in quite hopeless situation. It's quite easy to use plain C functions imported from DLLs since you just find the correct function address and then call it (you have to know the return type and arguments it expects). In case of C++, class methods are exported as plain C functions and their names are mangled (so that you can have both Class1::DoSomething() and Class2::DoSomething()). Also, you don't really have to know the return type and arguments since their description is a part of the mangled name. |
Line 14: | Line 14: |
=== Method name de-mangling === === Windows C++ call convention === |
Importing classes from WIndows DLLs
This is a work in progress...
What do we want to achieve
During the work on my school's final work I had to "steal" some functionality from binary-only Windows DLLs which were unfortunately written in C++ (object-oriented). Since there is no real standard in how methods/classes should be exported I've found myself in quite hopeless situation. It's quite easy to use plain C functions imported from DLLs since you just find the correct function address and then call it (you have to know the return type and arguments it expects). In case of C++, class methods are exported as plain C functions and their names are mangled (so that you can have both Class1::DoSomething() and Class2::DoSomething()). Also, you don't really have to know the return type and arguments since their description is a part of the mangled name.
How to achieve that
Method name de-mangling