Decompiling a Method Implemented with extern keyword
when I decompiled a dll file with Reflector, I saw that the method I need is implemented as below. What does it mean? Is that possible to see the source code behind it?
[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime), DispId(0x3a)]
public virtual extern string GetCOL开发者_如何学PythonDText([In] int PageNumber, [In] int Row, [In] int Column, [In, Optional, DefaultParameterValue(0x7fffffff)] int Length);
Regards.
This is what you see when you use Reflector to look at a COM interop library that was created by tlbimp.exe. Or by adding a reference in the IDE to a COM server from the COM tab or Browse tab, same thing.
If you look at the outer class or interface that contains this method then you'll see the COM coclass or interface that contains this method. Important attributes on it are [ComImport] to indicate that it is implemented in another DLL and [Guid], the all important interface IID or coclass CLSID. COM classes and interfaces are uniquely identified by a guid, not a name. The CLSID guid is present in the registry, HKCR\CLSID\{guid}
key.
COM servers like this are almost always implemented in an unmanaged language, C++ is most typical, but also Delphi or VB6. Decompiling C++ code after it is compiled is a fruitless exercise but you can get something out of Dumpbin.exe with the /disasm option. Assembly language programming skills and reams of free time are required. It is almost always expressly forbidden in the license agreement.
Wat it means is that this is a method in an unmanaged (interop) DLL. Most likely written in C++ and/or C
You could try to decompile that (using other tools, not Reflector) but it is not going to be easy and the result will not be very good.
Looks like that's a call to an unmanaged (probably COM) dll. So reflector wouldn't be able to decompile/disassemble it; but if you can read x86 assembler you may be able to get somewhere.
精彩评论