本文整理汇总了C++中Section::dump方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::dump方法的具体用法?C++ Section::dump怎么用?C++ Section::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::dump方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Section
std::vector<Section*> get_executable_section(std::ifstream &file)
{
std::vector<Section*> exc_sect;
for(iter_rp_section it = sections.begin(); it != sections.end(); ++it)
{
if((*it)->flags & S_ATTR_PURE_INSTRUCTIONS || (*it)->flags & S_ATTR_SOME_INSTRUCTIONS)
{
Section *s = new Section(
(char*)(*it)->sectname,
(*it)->offset,
(*it)->addr,
(*it)->size
);
if(s == NULL)
RAISE_EXCEPTION("Cannot allocate s");
s->dump(file);
s->set_props(Section::Executable);
exc_sect.push_back(s);
}
}
return exc_sect;
}
示例2: new
std::vector<Section*> get_executable_section(std::ifstream &file) const
{
std::vector<Section*> exec_sections;
for(iter_elf_phdr it = elfProgramHeaders.begin(); it != elfProgramHeaders.end(); ++it)
{
if((*it)->p_flags & 1)
{
Section *sec = new (std::nothrow) Section(
type_to_str((*it)->p_type).c_str(),
(*it)->p_offset,
(*it)->p_vaddr,
(*it)->p_filesz
);
if(sec == NULL)
RAISE_EXCEPTION("Cannot alocate a section");
sec->dump(file);
sec->set_props(Section::Executable);
exec_sections.push_back(sec);
}
}
return exec_sections;
}
示例3: new
std::vector<Section*> PE::get_executables_section(std::ifstream & file)
{
std::vector<Section*> exec_sections;
for(std::vector<RP_IMAGE_SECTION_HEADER*>::iterator it = m_pPELayout->imgSectionHeaders.begin();
it != m_pPELayout->imgSectionHeaders.end();
++it)
{
if((*it)->Characteristics & RP_IMAGE_SCN_MEM_EXECUTE)
{
Section *tmp = new (std::nothrow) Section(
(*it)->get_name().c_str(),
(*it)->PointerToRawData,
/* in the PE, this field is a RVA, so we need to add it the image base to have a VA */
m_pPELayout->get_image_base() + (*it)->VirtualAddress,
(*it)->SizeOfRawData
);
if(tmp == NULL)
RAISE_EXCEPTION("Cannot allocate a section");
tmp->dump(file);
tmp->set_props(Section::Executable);
exec_sections.push_back(tmp);
}
}
return exec_sections;
}
示例4: new
std::vector<Section*> Raw::get_executables_section(std::ifstream & file)
{
std::vector<Section*> executable_sections;
unsigned long long raw_file_size = get_file_size(file);
/* It is a raw file -> we have only one "virtual" section */
Section *sect = new (std::nothrow) Section(
".raw",
0,
0,
raw_file_size
);
if(sect == NULL)
RAISE_EXCEPTION("Cannot allocate sect");
sect->dump(file);
sect->set_props(Section::Executable);
executable_sections.push_back(sect);
return executable_sections;
}