Trivalik Trivalik
2012-03-08 19:23:26 UTC
In VTable is a structure:
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct VTable {
[FieldOffset(0)]
public int BaseTypeIdentifier;
[FieldOffset(4)]
public int MethodCount;
[FieldOffset(8)]
public int[] MethodIndexes;
[FieldOffset(12)]
public int[] MethodAddresses;
[FieldOffset(16)]
public uint TypeInitialized;
}
You see the size is wrong. So I want only know is there a cause of it or is this a bug. This will lead to a crash if we use that type like:
VTable[] tmpForlooking = mTypes;
VTable tmpcurrentVtable = mTypes[aType];
Me is wondering if I change the size to 20. It leads to crash in PCI.AddDevice() part in virtual string.Concat(object o) to resolve ToString() in Line:
Console.WriteLine(str + device.bus + ":" + device.slot + ":" + device.function + " " + PCIDevice.DeviceClass.GetString(device));
VMT code is here the problem.
Me is wondering that in "GetMethodAddressForType" the baseTypeIdentifier is new assigned after the for loop. Which is 100% an invalid value, because of his size. The debugger shows a length of 0xffffffff. Which cause the crash.
Any idea?
Please also try to change the size to 20 and try to run if somebody has also crashes.
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct VTable {
[FieldOffset(0)]
public int BaseTypeIdentifier;
[FieldOffset(4)]
public int MethodCount;
[FieldOffset(8)]
public int[] MethodIndexes;
[FieldOffset(12)]
public int[] MethodAddresses;
[FieldOffset(16)]
public uint TypeInitialized;
}
You see the size is wrong. So I want only know is there a cause of it or is this a bug. This will lead to a crash if we use that type like:
VTable[] tmpForlooking = mTypes;
VTable tmpcurrentVtable = mTypes[aType];
Me is wondering if I change the size to 20. It leads to crash in PCI.AddDevice() part in virtual string.Concat(object o) to resolve ToString() in Line:
Console.WriteLine(str + device.bus + ":" + device.slot + ":" + device.function + " " + PCIDevice.DeviceClass.GetString(device));
VMT code is here the problem.
Me is wondering that in "GetMethodAddressForType" the baseTypeIdentifier is new assigned after the for loop. Which is 100% an invalid value, because of his size. The debugger shows a length of 0xffffffff. Which cause the crash.
Any idea?
Please also try to change the size to 20 and try to run if somebody has also crashes.