Support .vtentry directive
MSDN-WhiteKnight opened this issue · comments
MSDN.WhiteKnight commented
Example C++/CLI program:
using namespace System;
public class A {
int _x;
public: A(int x) { this->_x = x; }
};
int main(array<System::String ^> ^args)
{
A a(1);
Console::ReadKey();
return 0;
}
Expected disassembler output:
.method assembly static valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall)
'A.{ctor}'(valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) A_0,
int32 x) cil managed
{
.vtentry 1 : 1
//...
}
The VTable data is stored in the location pointed int the CLI Header (ECMA 335 II.25.3.3). Code to get vtable data:
PEReader pr;
//...
int vt_rva = pr.PEHeaders.CorHeader.VtableFixupsDirectory.RelativeVirtualAddress;
var vt_data=pr.GetSectionData(vt_rva).GetContent();