private static long ScanVft(byte[] data, long addr, long fileFix, RttiHelp help) { long file_loc = addr - fileFix; long offset = 0; long class_addr = ReadUint32BE(data, file_loc); offset += 4; if (class_addr == 0) { return(addr + offset); } help.AddClassRef(addr, class_addr); while (help.HasWork()) { var w_addr = help.GetWork(); var w_class = new ClassHdr(help, data, w_addr, fileFix); help.AddClass(w_addr, w_class); } var thisClass = help.GetClass(class_addr); var activeClass = thisClass; int funcOffset = 0; int classOffset = 0; int state = 0; while (ReadUint32BE(data, file_loc + offset) != 0) { int val = (int)ReadUint32BE(data, file_loc + offset); offset += 4; if (state == 0) { if (val < 0) { funcOffset = 0; classOffset = val; state = 1; } else { thisClass.AddFunction(classOffset, funcOffset, val); funcOffset += 1; } } else if (state == 1) { // check class is same as above if (val != class_addr) { int z = 0; } state = 0; } } return(addr + offset + 4); }
private static long ScanVft(byte[] data, long addr, long fileFix, RttiHelp help) { long file_loc = addr - fileFix; long offset = 0; long class_addr = ReadUint32BE(data, file_loc); offset += 4; if (class_addr == 0) return addr + offset; help.AddClassRef(addr, class_addr); while (help.HasWork()) { var w_addr = help.GetWork(); var w_class = new ClassHdr(help, data, w_addr, fileFix); help.AddClass(w_addr, w_class); } var thisClass = help.GetClass(class_addr); var activeClass = thisClass; int funcOffset = 0; int classOffset = 0; int state = 0; while (ReadUint32BE(data, file_loc + offset) != 0) { int val = (int)ReadUint32BE(data, file_loc + offset); offset += 4; if (state == 0) { if (val < 0) { funcOffset = 0; classOffset = val; state = 1; } else { thisClass.AddFunction(classOffset, funcOffset, val); funcOffset += 1; } } else if (state == 1) { // check class is same as above if (val != class_addr) { int z = 0; } state = 0; } } return addr + offset + 4; }
public void AddClass(long addr, ClassHdr hdr) { hdrs.Add(addr, hdr); }