예제 #1
0
void idaapi dump_type_info(int file_id, const VTBL_info_t& vtbl_info, const qstring& type_name, const std::map<ea_t, VTBL_info_t>& vtbl_map) {
	struc_t * struc_type = get_struc(get_struc_id(type_name.c_str()));
	if (!struc_type)
		return;

	qstring file_entry_key;
	qstring key_hash;
	bool filtered = false;

	get_struct_key(struc_type, vtbl_info, file_entry_key, filtered, vtbl_map);
	get_hash_of_string(file_entry_key, key_hash);

	if (filtered)
		return;

	qstring file_entry_val;
	tinfo_t new_type = create_typedef(type_name.c_str());

	if (new_type.is_correct() && new_type.print(&file_entry_val, NULL, PRTYPE_DEF | PRTYPE_1LINE)) {
		qstring line;

		line = key_hash + ";" + file_entry_key + ";";
		line.cat_sprnt("%a;", vtbl_info.ea_begin);
		line += file_entry_val + ";";

		if (rtti_vftables.count(vtbl_info.ea_begin) != 0) {
			VTBL_info_t vi = rtti_vftables[vtbl_info.ea_begin];
			line += vi.vtbl_name;
		}
		line.rtrim();
		line += "\r\n";
		qwrite(file_id, line.c_str(), line.length());
	}
}
예제 #2
0
void idaapi dump_type_info(int file_id, VTBL_info_t vtbl_info, qstring type_name, std::map<ea_t, VTBL_info_t> vtbl_map) {
	tid_t type_id = get_struc_id(type_name.c_str());
	if (type_id != BADADDR) {
		struc_t * struc_type = get_struc(type_id);
		if(struc_type != NULL) {
			qstring file_entry_key;
			qstring key_hash;
			bool filtered = false;
			
			get_struct_key(struc_type, vtbl_info, file_entry_key, filtered, vtbl_map);
			get_hash_of_string(file_entry_key, key_hash);

			if (!filtered) {
				qstring file_entry_val;
				tinfo_t new_type = create_typedef(type_name.c_str());
				if(new_type.is_correct()) {
					if (new_type.print(&file_entry_val, NULL, PRTYPE_DEF | PRTYPE_1LINE)) {
						qstring line;

						line = key_hash + ";" + file_entry_key + ";";
						line.cat_sprnt("%p;", vtbl_info.ea_begin);
						line += file_entry_val + ";";
						
						if (rtti_vftables.count(vtbl_info.ea_begin) != 0) {
							vftable::vtinfo vi = rtti_vftables[vtbl_info.ea_begin];
							line += vi.type_info;
						}
						line.rtrim();
						line += "\r\n";
						qwrite(file_id, line.c_str(), line.length());
					}
				}
			}
		}
	}
}