//---------------------------------------------------------------------- static void fixup(uint32 ea, uint32 delta, int extdef) { fixup_data_t fd; fd.type = FIXUP_OFF32; if ( extdef ) fd.type |= FIXUP_EXTDEF; segment_t *s = getseg(delta); fd.displacement = get_long(ea); if ( s == NULL ) { fd.sel = 0; fd.off = delta; } else { fd.sel = (ushort)s->sel; fd.off = delta - get_segm_base(s); } set_fixup(ea, &fd); uint32 target = get_long(ea) + delta; put_long(ea, target); set_offset(ea, 0, 0); cmd.ea = ea; ua_add_dref(0, target, dr_O); cmd.ea = BADADDR; if ( target != toc_ea && !has_name(get_flags_novalue(ea)) && has_name(get_flags_novalue(target)) ) { char buf[MAXSTR]; if ( get_true_name(BADADDR, target, &buf[3], sizeof(buf)-3) != NULL ) { buf[0] = 'T'; buf[1] = 'C'; buf[2] = '_'; do_name_anyway(ea, buf); make_name_auto(ea); } } // toc.charset(ea,XMC_TC+1,1); }
unicode Background::__unicode__() const { if(has_name()) { return name(); } else { return _u("Background {0}").format(this->id()); } }
void Person::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:tutorial.Person) // required string name = 1; if (has_name()) { ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 1, this->name(), output); } // required int32 id = 2; if (has_id()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->id(), output); } // optional string email = 3; if (has_email()) { ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 3, this->email(), output); } // repeated .tutorial.Person.PhoneNumber phone = 4; for (int i = 0; i < this->phone_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteMessage( 4, this->phone(i), output); } output->WriteRaw(unknown_fields().data(), unknown_fields().size()); // @@protoc_insertion_point(serialize_end:tutorial.Person) }
QStringList Ida2db::getAllNamedFunctions() { QStringList output; int numOfFuncs = get_func_qty(); if (numOfFuncs <= 0) { (void) msg("IDB2SIG: Not found any functions\n"); return output; } int i = 0; //size_t len = 0; func_t* pFunc = NULL; for (i = 0; i < numOfFuncs; i++) { pFunc = getn_func(i); if ((NULL != pFunc) && has_name(getFlags(pFunc->startEA)) && !(pFunc->flags & FUNC_LIB)) { char buf[512]; get_true_name(BADADDR, pFunc->startEA, buf, sizeof(buf)); //get_segm_name(pFunc->startEA, buf, sizeof buf); output.append(buf); //len += make_func_sig(pFunc->startEA, // (ulong) (pFunc->endEA - pFunc->startEA), // &pSigBuf[len]); } } return output; }
// Function to find the record for a name in records starting at index start. // count is the number of elements in records. // The index to the record is returned or -1 if it doesn't exist. int find_record(PhoneRecord records[], size_t start, size_t count, const Name *pName) { for(size_t i = start ; i < count ; ++i) { if(has_name(&records[i], pName)) // Test for the name return i; } return -1; }
int BuyGold::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional uint32 id = 1; if (has_id()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->id()); } // optional string name = 2; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional string describ = 3; if (has_describ()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->describ()); } // optional uint32 gold_Number = 4; if (has_gold_number()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->gold_number()); } // optional int32 money = 5; if (has_money()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->money()); } // optional string localName = 6; if (has_localname()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->localname()); } } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; }
size_t VtableScanner::getVtableMethodsCount ( ea_t curAddress ) { ea_t startTable = BADADDR; ea_t curEntry = 0; // Iterate until we find a result for (; ; curAddress += 4) { flags_t flags = IDAUtils::GetFlags (curAddress); // First iteration if (startTable == BADADDR) { startTable = curAddress; if (!(hasRef (flags) && (has_name (flags) || (flags & FF_LABL)))) { // Start of vtable should have a xref and a name (auto or manual) return 0; } } else if (hasRef (flags)) { // Might mean start of next vtable break; } if (!hasValue (flags) || !isData (flags)) { break; } if ((curEntry = get_long (curAddress))) { flags = IDAUtils::GetFlags (curEntry); if (!hasValue (flags) || !isCode (flags) || get_long (curEntry) == 0) { break; } } } if (startTable != BADADDR) { return (curAddress - startTable) / 4; } else { // No vtable at this EA return 0; } }
void UserBasicInfo::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_uid()) { if (uid_ != &::google::protobuf::internal::kEmptyString) { uid_->clear(); } } if (has_name()) { if (name_ != &::google::protobuf::internal::kEmptyString) { name_->clear(); } } level_ = 1u; style_ = 0u; wincount_ = 0u; losecount_ = 0u; winrate_ = 0; if (has_effect()) { if (effect_ != NULL) effect_->::message::UserBasicInfo_EffectData::Clear(); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { iconid_ = 6000u; successionwincount_ = 0u; oncelong_ = 0u; maximum_ = GOOGLE_ULONGLONG(0); totaltime_ = GOOGLE_ULONGLONG(0); roundsplayed_ = 0u; throwstones_ = 0u; thrownstones_ = 0u; } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { colorcats_ = 0u; consumegolds_ = 0u; consumeitems1_ = 0u; consumeitems2_ = 0u; consumeitems3_ = 0u; consumeitems4_ = 0u; golds_ = 0u; experience_ = 0u; } if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) { maxexperience_ = 1u; } buyequipframe_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); }
void Person::Clear() { if (_has_bits_[0 / 32] & 7) { if (has_name()) { if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } } id_ = 0; if (has_email()) { if (email_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { email_->clear(); } } } phone_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->clear(); }
// -------------------------------------------------------------------- void _write(std::ostream & out) const { const auto end = _children.end(); // // Loop over each child, if any. // auto iter = _children.begin(); if (iter != end) { // // Enclose all children in parentheses. // out << '('; (*iter)->_write(out); // // Separate children with commas. // while (++iter != end) { out << ','; (*iter)->_write(out); } // // Close the parentheses for the children. // out << ')'; } // // Write the name, if one exists. // if (has_name()) out << _name; // // Write the length, if one exists. // if (_has_length) out << ':' << _length; }
int RseObtainSocialUserInfo::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string name = 1; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional string photoURL = 2; if (has_photourl()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->photourl()); } // optional int32 fan = 3; if (has_fan()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->fan()); } } // repeated .MsgSocialUserInfo SocialUserInfo = 4; total_size += 1 * this->socialuserinfo_size(); for (int i = 0; i < this->socialuserinfo_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->socialuserinfo(i)); } if (!unknown_fields().empty()) { total_size += ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( unknown_fields()); } _cached_size_ = total_size; return total_size; }
int Person::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string name = 1; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // required int32 id = 2; if (has_id()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->id()); } // optional string email = 3; if (has_email()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->email()); } } // repeated .tutorial.Person.PhoneNumber phone = 4; total_size += 1 * this->phone_size(); for (int i = 0; i < this->phone_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->phone(i)); } total_size += unknown_fields().size(); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; }
void BuyGold::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { id_ = 0u; if (has_name()) { if (name_ != &::google::protobuf::internal::kEmptyString) { name_->clear(); } } if (has_describ()) { if (describ_ != &::google::protobuf::internal::kEmptyString) { describ_->clear(); } } gold_number_ = 0u; money_ = 0; if (has_localname()) { if (localname_ != &::google::protobuf::internal::kEmptyString) { localname_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); }
void BuyGold::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional uint32 id = 1; if (has_id()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output); } // optional string name = 2; if (has_name()) { ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->name(), output); } // optional string describ = 3; if (has_describ()) { ::google::protobuf::internal::WireFormatLite::WriteString( 3, this->describ(), output); } // optional uint32 gold_Number = 4; if (has_gold_number()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->gold_number(), output); } // optional int32 money = 5; if (has_money()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->money(), output); } // optional string localName = 6; if (has_localname()) { ::google::protobuf::internal::WireFormatLite::WriteString( 6, this->localname(), output); } }
int UserBasicInfo::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string uid = 1; if (has_uid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->uid()); } // optional string name = 2; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional uint32 level = 3 [default = 1]; if (has_level()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->level()); } // optional uint32 style = 4; if (has_style()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->style()); } // optional uint32 winCount = 5; if (has_wincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->wincount()); } // optional uint32 loseCount = 6; if (has_losecount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->losecount()); } // optional float winRate = 7; if (has_winrate()) { total_size += 1 + 4; } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->effect()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->iconid()); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->successionwincount()); } // optional uint32 onceLong = 11; if (has_oncelong()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->oncelong()); } // optional uint64 maximum = 12; if (has_maximum()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->maximum()); } // optional uint64 totalTime = 13; if (has_totaltime()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->totaltime()); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->roundsplayed()); } // optional uint32 throwStones = 15; if (has_throwstones()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->throwstones()); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->thrownstones()); } } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { // optional uint32 colorCats = 17; if (has_colorcats()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->colorcats()); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumegolds()); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems1()); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems2()); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems3()); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems4()); } // optional uint32 golds = 23; if (has_golds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->golds()); } // optional uint32 experience = 24; if (has_experience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->experience()); } } if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) { // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->maxexperience()); } } // repeated uint32 buyEquipFrame = 26; { int data_size = 0; for (int i = 0; i < this->buyequipframe_size(); i++) { data_size += ::google::protobuf::internal::WireFormatLite:: UInt32Size(this->buyequipframe(i)); } total_size += 2 * this->buyequipframe_size() + data_size; } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; }
bool has_meaningful_name(ea_t ea) { _ASSERTE(isEnabled(ea)); char tmp[MAXNAMESIZE]; return has_name(get_flags_novalue(ea)) && get_true_name(BADADDR, ea, CPY(tmp)) != 0 && !pcre_match("^unknown_libname_\\d+$", tmp); }
static void idaapi run(int /* arg */) { static char mapFileName[_MAX_PATH] = { 0 }; // If user press shift key, show options dialog if (GetAsyncKeyState(VK_SHIFT) & 0x8000) { ShowOptionsDlg(); } ulong numOfSegs = (ulong) get_segm_qty(); if (0 == numOfSegs) { warning("Not found any segments"); return; } if ('\0' == mapFileName[0]) { // First run strncpy(mapFileName, get_input_file_path(), sizeof(mapFileName)); WIN32CHECK(PathRenameExtension(mapFileName, ".map")); } // Show open map file dialog char *fname = askfile_c(0, mapFileName, "Open MAP file"); if (NULL == fname) { msg("LoadMap: User cancel\n"); return; } // Open the map file LPSTR pMapStart = NULL; DWORD mapSize = INVALID_FILE_SIZE; MAP_OPEN_ERROR eRet = MapFileOpen(fname, pMapStart, mapSize); switch (eRet) { case WIN32_ERROR: warning("Could not open file '%s'.\nWin32 Error Code = 0x%08X", fname, GetLastError()); return; case FILE_EMPTY_ERROR: warning("File '%s' is empty, zero size", fname); return; case FILE_BINARY_ERROR: warning("File '%s' seem to be a binary or Unicode file", fname); return; case OPEN_NO_ERROR: default: break; } bool foundHdr = false; ulong validSyms = 0; ulong invalidSyms = 0; // The mark pointer to the end of memory map file // all below code must not read or write at and over it LPSTR pMapEnd = pMapStart + mapSize; show_wait_box("Parsing and applying symbols from the Map file '%s'", fname); __try { LPSTR pLine = pMapStart; LPSTR pEOL = pMapStart; while (pLine < pMapEnd) { // Skip the spaces, '\r', '\n' characters, blank lines, seek to the // non space character at the beginning of a non blank line pLine = SkipSpaces(pEOL, pMapEnd); // Find the EOL '\r' or '\n' characters pEOL = FindEOL(pLine, pMapEnd); size_t lineLen = (size_t) (pEOL - pLine); if (lineLen < g_minLineLen) { continue; } if (!foundHdr) { if ((0 == strnicmp(pLine, VC_HDR_START , lineLen)) || (0 == strnicmp(pLine, BL_HDR_NAME_START , lineLen)) || (0 == strnicmp(pLine, BL_HDR_VALUE_START, lineLen))) { foundHdr = true; } } else { ulong seg = SREG_NUM; ulong addr = BADADDR; char name[MAXNAMELEN + 1]; char fmt[80]; name[0] = '\0'; fmt[0] = '\0'; // Get segment number, address, name, by pass spaces at beginning, // between ':' character, between address and name int ret = _snscanf(pLine, min(lineLen, MAXNAMELEN + g_minLineLen), " %04X : %08X %s", &seg, &addr, name); if (3 != ret) { // we have parsed to end of value/name symbols table or reached EOF _snprintf(fmt, sizeof(fmt), "Parsing finished at line: '%%.%ds'.\n", lineLen); ShowMsg(fmt, pLine); break; } else if ((0 == seg) || (--seg >= numOfSegs) || (BADADDR == addr) || ('\0' == name[0])) { sprintf(fmt, "Invalid map line: %%.%ds.\n", lineLen); ShowMsg(fmt, pLine); invalidSyms++; } else { // Ensure name is NULL terminated name[MAXNAMELEN] = '\0'; // Determine the DeDe map file bool bNameApply = g_options.bNameApply; char *pname = name; if (('<' == pname[0]) && ('-' == pname[1])) { // Functions indicator symbol of DeDe map pname += 2; bNameApply = true; } else if ('*' == pname[0]) { // VCL controls indicator symbol of DeDe map pname++; bNameApply = false; } else if (('-' == pname[0]) && ('>' == pname[1])) { // VCL methods indicator symbol of DeDe map pname += 2; bNameApply = false; } ulong la = addr + getnseg((int) seg)->startEA; flags_t f = getFlags(la); if (bNameApply) // Apply symbols for name { // Add name if there's no meaningful name assigned. if (g_options.bReplace || (!has_name(f) || has_dummy_name(f) || has_auto_name(f))) { if (set_name(la, pname, SN_NOWARN)) { ShowMsg("%04X:%08X - Change name to '%s' successed\n", seg, la, pname); validSyms++; } else { ShowMsg("%04X:%08X - Change name to '%s' failed\n", seg, la, pname); invalidSyms++; } } } else if (g_options.bReplace || !has_cmt(f)) { // Apply symbols for comment if (set_cmt(la, pname, false)) { ShowMsg("%04X:%08X - Change comment to '%s' successed\n", seg, la, pname); validSyms++; } else { ShowMsg("%04X:%08X - Change comment to '%s' failed\n", seg, la, pname); invalidSyms++; } } } } } } __finally { MapFileClose(pMapStart); hide_wait_box(); } if (!foundHdr) { warning("File '%s' is not a valid Map file", fname); } else { // Save file name for next askfile_c dialog strncpy(mapFileName, fname, sizeof(mapFileName)); // Show the result msg("Result of loading and parsing the Map file '%s'\n" " Number of Symbols applied: %d\n" " Number of Invalid Symbols: %d\n\n", fname, validSyms, invalidSyms); } }
/** * \copydoc LuaData::export_to_lua */ bool EntityData::export_to_lua(std::ostream& out) const { // Entity type. out << get_type_name() << "{\n"; // Name. if (has_name()) { out << " name = \"" << escape_string(get_name()) << "\",\n"; } // Position on the map. out << " layer = " << get_layer() << ",\n" << " x = " << get_xy().x << ",\n" << " y = " << get_xy().y << ",\n"; // Properties specific to a type of entity. const EntityTypeDescription& type_description = entity_type_descriptions.at(get_type()); for (const EntityFieldDescription& field_description : type_description) { const std::string& key = field_description.key; const bool optional = field_description.optional == OptionalFlag::OPTIONAL; switch (field_description.default_value.value_type) { case EntityFieldType::STRING: { const std::string& value = get_string(key); const std::string& default_value = field_description.default_value.string_value; if (optional && value == default_value) { // No need to write the value. continue; } out << " " << key << " = \"" << escape_string(value) << "\",\n"; break; } case EntityFieldType::INTEGER: { int value = get_integer(key); int default_value = field_description.default_value.int_value; if (optional && value == default_value) { // No need to write the value. continue; } out << " " << key << " = " << value << ",\n"; break; } case EntityFieldType::BOOLEAN: { bool value = get_boolean(key); bool default_value = field_description.default_value.int_value != 0; if (optional && value == default_value) { // No need to write the value. continue; } out << " " << key << " = " << (value ? "true" : "false") << ",\n"; break; } case EntityFieldType::NIL: Debug::die("Nil entity field"); break; } } out << "}\n\n"; return true; }
void idaapi run(int arg) { char buf[MAXSTR]; char cmt[MAXSTR]; char *valid_cmt = NULL; char ext[0x20]; FILE *f = NULL; short checkboxes = OPTION_NAMES | OPTION_COMMENTS; sval_t bank = 1; // default bool first = true; bool hasName = false; flags_t flags; ea_t ea = 0x0; if( AskUsingForm_c( madnes_options, &checkboxes, &bank ) != 1 || checkboxes == 0 ) return; // prepare filename for namelist (.nl) file get_input_file_path( buf, sizeof( buf ) ); qsnprintf( ext, sizeof( ext ),".%X.nl",--bank ); qstrncat( buf, ext, sizeof( buf )-strlen( buf ) ); // (always) create file f = qfopen( buf, "w" ); if( f == NULL ) { warning( "%s could not be created!", buf ); return; } msg( "Writing to file %s..", buf ); while( ea <= 0xFFFF ) { hasName = false; // get flags if( isCode( getFlags( ea ) ) ) flags = getFlags( ea ); else flags = getFlags( get_item_head( ea ) ); // if user either chose to export names or anynames if( ( ( checkboxes & OPTION_NAMES ) && has_name( flags ) ) || ( ( checkboxes & OPTION_ANYNAME ) && has_any_name( flags ) ) ) { // if current item is code or if current item is head of item if( isCode( flags ) || ea==get_item_head( ea ) ) { // get name get_name( ea, ea, buf, sizeof( buf ) ); // write to file qfprintf( f, "$%04X#%s#", ea, buf ); } else // if not code or not head of item (must be an array) { // get name of item start get_name( get_item_head( ea ), get_item_head( ea ), buf, sizeof( buf ) ); // calc displacement, write to file (example: "password+$04") qfprintf( f, "$%04X#%s+$%X#", ea, buf, ea-get_item_head( ea ) ); } hasName = true; } // if user chose to export cross references if( checkboxes & OPTION_XREFS ) { xrefblk_t xb; first = true; // cycle through all xrefs except ordinary flow xrefs for ( bool ok=xb.first_to( ea, XREF_FAR/*XREF_ALL*/); ok; ok=xb.next_to() ) { if( first ) // if first xref { if( !hasName ) // if this location hasn't a name yet, add symbol stub { qfprintf( f, "$%04X##", ea ); hasName = true; } qfprintf( f, "XREFS:\n\\"); // append XREFS first = false; } qfprintf( f, " $%04X\n\\", xb.from ); } } // if user chose to export comments if( checkboxes & OPTION_COMMENTS ) { if( has_cmt( flags ) ) // if current item has comment { // get comment // workaround for get_any_indeted_cmt() // -> unresolved external symbol "char * __stdcall get_any_indented_cmt(unsigned long,unsigned char *)" (?get_any_indented_cmt@@YGPADKPAE@Z) if( get_cmt( ea, false, cmt, sizeof( cmt ) ) == -1 ) get_cmt( ea, true, cmt, sizeof( cmt ) ); // validate comment (replace invalid chars, add room for additional chars) valid_cmt = validate_comment( cmt ); if( valid_cmt != NULL ) { if( !hasName ) { qfprintf( f, "$%04X##", ea ); // add symbol stub if no name yet hasName = true; } qfprintf( f, "%s", valid_cmt ); // write comment to file qfree( valid_cmt ); } } } if( hasName) qfprintf( f, "\n" ); ea++; // get name of each byte } qfclose( f ); msg( "done.\n" ); }
string class_mapper_base::full_child_name(const string &given_name) const { return has_name() ? name() + "." + given_name : given_name; }
void UserBasicInfo::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string uid = 1; if (has_uid()) { ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->uid(), output); } // optional string name = 2; if (has_name()) { ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->name(), output); } // optional uint32 level = 3 [default = 1]; if (has_level()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->level(), output); } // optional uint32 style = 4; if (has_style()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->style(), output); } // optional uint32 winCount = 5; if (has_wincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->wincount(), output); } // optional uint32 loseCount = 6; if (has_losecount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->losecount(), output); } // optional float winRate = 7; if (has_winrate()) { ::google::protobuf::internal::WireFormatLite::WriteFloat(7, this->winrate(), output); } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( 8, this->effect(), output); } // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->iconid(), output); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->successionwincount(), output); } // optional uint32 onceLong = 11; if (has_oncelong()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->oncelong(), output); } // optional uint64 maximum = 12; if (has_maximum()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(12, this->maximum(), output); } // optional uint64 totalTime = 13; if (has_totaltime()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->totaltime(), output); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(14, this->roundsplayed(), output); } // optional uint32 throwStones = 15; if (has_throwstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(15, this->throwstones(), output); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(16, this->thrownstones(), output); } // optional uint32 colorCats = 17; if (has_colorcats()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->colorcats(), output); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(18, this->consumegolds(), output); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(19, this->consumeitems1(), output); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(20, this->consumeitems2(), output); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(21, this->consumeitems3(), output); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(22, this->consumeitems4(), output); } // optional uint32 golds = 23; if (has_golds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(23, this->golds(), output); } // optional uint32 experience = 24; if (has_experience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->experience(), output); } // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->maxexperience(), output); } // repeated uint32 buyEquipFrame = 26; for (int i = 0; i < this->buyequipframe_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteUInt32( 26, this->buyequipframe(i), output); } }
// Process function void processFunction(func_t *f) { // Skip tiny functions if(f->size() >= 5) { // Don't add comments to API wrappers char name[MAXNAMELEN]; name[0] = name[SIZESTR(name)] = 0; if(!apiMap.empty()) { if(get_short_name(BADADDR, f->startEA, name, SIZESTR(name))) { if(apiMap.find(name) != apiMap.end()) return; } } // Iterate function body STRLIST importLstTmp; LPSTR commentPtr = NULL; char comment[MAXSTR]; comment[0] = comment[SIZESTR(comment)] = 0; UINT commentLen = 0; #define ADDNM(_str) { UINT l = strlen(_str); memcpy(comment + commentLen, _str, l); commentLen += l; _ASSERT(commentLen < MAXSTR); } func_item_iterator_t it(f); do { ea_t currentEA = it.current(); // Will be a "to" xref xrefblk_t xb; if(xb.first_from(currentEA, XREF_FAR)) { BOOL isImpFunc = FALSE; name[0] = 0; // If in import segment // ============================================================================================ ea_t refAdrEa = xb.to; if(isInImportSeg(refAdrEa)) { flags_t flags = get_flags_novalue(refAdrEa); if(has_name(flags) && hasRef(flags) && isDwrd(flags)) { if(get_short_name(BADADDR, refAdrEa, name, SIZESTR(name))) { // Nix the imp prefix if there is one if(strncmp(name, "__imp_", SIZESTR("__imp_")) == 0) memmove(name, name + SIZESTR("__imp_"), ((strlen(name) - SIZESTR("__imp_")) + 1)); isImpFunc = TRUE; } else msg(EAFORMAT" *** Failed to get import name! ***\n", refAdrEa); } } // Else, check for import wrapper // ============================================================================================ else if(!apiMap.empty()) { // Reference is a function entry? flags_t flags = get_flags_novalue(refAdrEa); if(isCode(flags) && has_name(flags) && hasRef(flags)) { if(func_t *refFuncPtr = get_func(refAdrEa)) { if(refFuncPtr->startEA == refAdrEa) { if(get_short_name(BADADDR, refAdrEa, name, SIZESTR(name))) { // Skip common unwanted types "sub_.." or "unknown_libname_.." if( // not "sub_.. /*"sub_"*/ (*((PUINT) name) != 0x5F627573) && // not "unknown_libname_.. /*"unknown_"*/ ((*((PUINT64) name) != 0x5F6E776F6E6B6E75) && (*((PUINT64) (name + 8)) != /*"libname_"*/ 0x5F656D616E62696C)) && // not nullsub_.. /*"nullsub_"*/ (*((PUINT64) name) != 0x5F6275736C6C756E) ) { // Nix the import prefixes if(strncmp(name, "__imp_", SIZESTR("__imp_")) == 0) memmove(name, name + SIZESTR("__imp_"), ((strlen(name) - SIZESTR("__imp_")) + 1)); // Assumed to be a wrapped import if it's in the list isImpFunc = (apiMap.find(name) != apiMap.end()); } } else msg(EAFORMAT" *** Failed to get function name! ***\n", refAdrEa); } } } } // Found import function to add list if(isImpFunc) { // Skip those large common STL names if(strncmp(name, "std::", SIZESTR("std::")) != 0) { // Skip if already seen in this function BOOL known = FALSE; for(STRLIST::iterator ji = importLstTmp.begin(); ji != importLstTmp.end(); ji++) { if(strcmp(ji->c_str(), name) == 0) { known = TRUE; break; } } // Not seen if(!known) { importLstTmp.push_front(name); // Append to existing comments w/line feed if(!commentLen && !commentPtr) { commentPtr = get_func_cmt(f, true); if(!commentPtr) get_func_cmt(f, false); if(commentPtr) { commentLen = strlen(commentPtr); // Bail out not enough comment space if(commentLen >= (MAXSTR - 20)) { qfree(commentPtr); return; } memcpy(comment, commentPtr, commentLen); ADDNM("\n"MYTAG); } } if(!commentLen) ADDNM(MYTAG); // Append a "..." (continuation) and bail out if name hits max comment length if((commentLen + strlen(name) + SIZESTR("()") + sizeof(", ")) >= (MAXSTR - sizeof("..."))) { ADDNM(" ..."); break; } // Append this function name else { if(importLstTmp.size() != 1) ADDNM(", "); ADDNM(name); ADDNM("()"); } } } else { //msg("%s\n", szName); } } } }while(it.next_addr()); if(!importLstTmp.empty() && commentLen) { // Add comment comment[commentLen] = 0; set_func_cmt(f, comment, true); commentCount++; } if(commentPtr) qfree(commentPtr); } }
int RceQueryRefuseReceiveWishItem::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string type = 1; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->type()); } // optional string name = 2; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional string playerId = 3; if (has_playerid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->playerid()); } // optional string id = 4; if (has_id()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->id()); } // optional string guid = 5; if (has_guid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->guid()); } // optional string planetId = 6; if (has_planetid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->planetid()); } // optional string time = 7; if (has_time()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->time()); } // optional string msg = 8; if (has_msg()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->msg()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional string url = 9; if (has_url()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->url()); } } if (!unknown_fields().empty()) { total_size += ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( unknown_fields()); } _cached_size_ = total_size; return total_size; }
int MsgNeighbor::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string platform = 1; if (has_platform()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->platform()); } // optional int64 accountId = 2; if (has_accountid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( this->accountid()); } // optional int32 score = 3; if (has_score()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->score()); } // optional int32 xp = 4; if (has_xp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->xp()); } // optional string extId = 5; if (has_extid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->extid()); } // optional string url = 6; if (has_url()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->url()); } // optional string name = 7; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional int32 isNeighbor = 8; if (has_isneighbor()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->isneighbor()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional int32 levelBasedOnScore = 9; if (has_levelbasedonscore()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->levelbasedonscore()); } // optional string wishlist = 10; if (has_wishlist()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->wishlist()); } // optional int64 damageProtectionTimeLeft = 11; if (has_damageprotectiontimeleft()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( this->damageprotectiontimeleft()); } // optional int32 tutorialCompleted = 12; if (has_tutorialcompleted()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->tutorialcompleted()); } } // repeated .MsgPlanet neighbor = 13; total_size += 1 * this->neighbor_size(); for (int i = 0; i < this->neighbor_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->neighbor(i)); } if (!unknown_fields().empty()) { total_size += ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( unknown_fields()); } _cached_size_ = total_size; return total_size; }