retdec
Classes | Typedefs | Enumerations | Functions | Variables
retdec::fileformat Namespace Reference

Classes

class  CoffFormat
 
class  ElfFormat
 
struct  LoaderErrorInfo
 
class  FileFormat
 
class  IntelHexFormat
 
class  IntelHexSection
 The IntelHexSection class - Intel HEX pseudosection. More...
 
class  IntelHexParser
 The IntelHexParser class - Intel HEX semantical analysis. More...
 
class  IntelHexToken
 The Token class - output of tokenizer. More...
 
class  IntelHexTokenizer
 The Tokenizer class - Intel HEX lexical analysis. More...
 
class  MachOFormat
 
class  PeFormat
 
class  PeFormatParser
 
class  RawDataFormat
 
class  Certificate
 
class  CertificateTable
 
class  BlobStream
 
class  CLRHeader
 
class  GuidStream
 
class  MetadataHeader
 
class  MetadataStream
 
class  BaseMetadataTable
 
class  MetadataTable
 
struct  Index
 
struct  CompoundIndex
 
struct  StringStreamIndex
 
struct  BlobStreamIndex
 
struct  GuidStreamIndex
 
struct  FieldTableIndex
 
struct  MethodDefTableIndex
 
struct  ParamTableIndex
 
struct  TypeDefTableIndex
 
struct  EventTableIndex
 
struct  PropertyTableIndex
 
struct  ModuleRefTableIndex
 
struct  AssemblyRefTableIndex
 
struct  GenericParamTableIndex
 
struct  TypeDefOrRef
 
struct  HasConstant
 
struct  HasCustomAttribute
 
struct  HasFieldMarshal
 
struct  HasDeclSecurity
 
struct  MemberRefParent
 
struct  HasSemantics
 
struct  MethodDefOrRef
 
struct  MemberForwarded
 
struct  Implementation
 
struct  CustomAttributeType
 
struct  ResolutionScope
 
struct  TypeDefOrMethodDef
 
class  InvalidDotnetRecordError
 
struct  BaseRecord
 
struct  DotnetModule
 
struct  TypeRef
 
struct  TypeDef
 
struct  FieldPtr
 
struct  Field
 
struct  MethodPtr
 
struct  MethodDef
 
struct  ParamPtr
 
struct  Param
 
struct  InterfaceImpl
 
struct  MemberRef
 
struct  Constant
 
struct  CustomAttribute
 
struct  FieldMarshal
 
struct  DeclSecurity
 
struct  ClassLayout
 
struct  FieldLayout
 
struct  StandAloneSig
 
struct  EventMap
 
struct  Event
 
struct  PropertyPtr
 
struct  PropertyMap
 
struct  Property
 
struct  MethodSemantics
 
struct  MethodImpl
 
struct  ModuleRef
 
struct  TypeSpec
 
struct  ImplMap
 
struct  FieldRVA
 
struct  ENCLog
 
struct  ENCMap
 
struct  Assembly
 
struct  AssemblyProcessor
 
struct  AssemblyOS
 
struct  AssemblyRef
 
struct  AssemblyRefProcessor
 
struct  AssemblyRefOS
 
struct  File
 
struct  ExportedType
 
struct  ManifestResource
 
struct  NestedClass
 
struct  GenericParam
 
struct  MethodSpec
 
struct  GenericParamContstraint
 
class  Stream
 
class  StringStream
 
class  UserStringStream
 
class  DotnetClass
 
class  DotnetDataTypeBase
 
class  DotnetDataType
 
class  DotnetDataType< ElementType::Ptr >
 
class  DotnetDataType< ElementType::ByRef >
 
class  DotnetDataType< ElementType::ValueType >
 
class  DotnetDataType< ElementType::Class >
 
class  DotnetDataType< ElementType::GenericVar >
 
class  DotnetDataType< ElementType::Array >
 
class  DotnetDataType< ElementType::GenericInst >
 
class  DotnetDataType< ElementType::FnPtr >
 
class  DotnetDataType< ElementType::SzArray >
 
class  DotnetDataType< ElementType::GenericMVar >
 
class  DotnetDataType< ElementType::CModRequired >
 
class  DotnetDataType< ElementType::CModOptional >
 
class  DotnetField
 
class  DotnetMethod
 
class  DotnetParameter
 
class  DotnetProperty
 
class  DotnetType
 
class  DotnetTypeReconstructor
 
class  DynamicEntry
 
class  DynamicTable
 
class  Export
 
class  ExportTable
 
class  Import
 
class  ImportTable
 
class  PeImport
 
class  FileMapEntry
 
class  PrStatusInfo
 
class  ElfCoreInfo
 
class  ElfNoteEntry
 
class  ElfNoteSecSeg
 
class  PdbInfo
 
class  Relocation
 
class  RelocationTable
 
struct  BitmapInformationHeader
 
struct  BitmapPixel
 
class  BitmapImage
 
class  Resource
 
class  ResourceIcon
 
class  ResourceIconGroup
 
class  ResourceTable
 
class  ResourceTree
 
class  LinkerInfo
 
class  RichHeader
 
class  ElfSection
 
class  ElfSegment
 
class  MachOSection
 
class  PeCoffSection
 
class  SecSeg
 
class  Section
 
class  Segment
 
class  CharacterIterator
 
class  String
 
class  ElfSymbol
 
class  MachOSymbol
 
class  Symbol
 
class  SymbolTable
 
class  TlsInfo
 
class  VisualBasicExtern
 
class  VisualBasicInfo
 
class  VisualBasicObject
 
struct  VBHeader
 
struct  VBProjInfo
 
struct  VBObjectTable
 
struct  VBPublicObjectDescriptor
 
struct  VBExternTableEntry
 
struct  VBExternTableEntryData
 
struct  VBCOMRData
 
struct  VBCOMRInfo
 
class  Asn1Item
 
class  Asn1Null
 
class  Asn1BitString
 
class  Asn1OctetString
 
class  Asn1Object
 
class  Asn1Sequence
 
class  Asn1ContextSpecific
 
class  byte_array_buffer
 

Typedefs

using DotnetDataTypeEnd = DotnetDataType< ElementType::End >
 
using DotnetDataTypeVoid = DotnetDataType< ElementType::Void >
 
using DotnetDataTypeBoolean = DotnetDataType< ElementType::Boolean >
 
using DotnetDataTypeChar = DotnetDataType< ElementType::Char >
 
using DotnetDataTypeInt8 = DotnetDataType< ElementType::Int8 >
 
using DotnetDataTypeUInt8 = DotnetDataType< ElementType::UInt8 >
 
using DotnetDataTypeInt16 = DotnetDataType< ElementType::Int16 >
 
using DotnetDataTypeUInt16 = DotnetDataType< ElementType::UInt16 >
 
using DotnetDataTypeInt32 = DotnetDataType< ElementType::Int32 >
 
using DotnetDataTypeUInt32 = DotnetDataType< ElementType::UInt32 >
 
using DotnetDataTypeInt64 = DotnetDataType< ElementType::Int64 >
 
using DotnetDataTypeUInt64 = DotnetDataType< ElementType::UInt64 >
 
using DotnetDataTypeFloat32 = DotnetDataType< ElementType::Float32 >
 
using DotnetDataTypeFloat64 = DotnetDataType< ElementType::Float64 >
 
using DotnetDataTypeString = DotnetDataType< ElementType::String >
 
using DotnetDataTypePtr = DotnetDataType< ElementType::Ptr >
 
using DotnetDataTypeByRef = DotnetDataType< ElementType::ByRef >
 
using DotnetDataTypeValueType = DotnetDataType< ElementType::ValueType >
 
using DotnetDataTypeClass = DotnetDataType< ElementType::Class >
 
using DotnetDataTypeGenericVar = DotnetDataType< ElementType::GenericVar >
 
using DotnetDataTypeArray = DotnetDataType< ElementType::Array >
 
using DotnetDataTypeGenericInst = DotnetDataType< ElementType::GenericInst >
 
using DotnetDataTypeTypedByRef = DotnetDataType< ElementType::TypedByRef >
 
using DotnetDataTypeIntPtr = DotnetDataType< ElementType::IntPtr >
 
using DotnetDataTypeUIntPtr = DotnetDataType< ElementType::UIntPtr >
 
using DotnetDataTypeFnPtr = DotnetDataType< ElementType::FnPtr >
 
using DotnetDataTypeObject = DotnetDataType< ElementType::Object >
 
using DotnetDataTypeSzArray = DotnetDataType< ElementType::SzArray >
 
using DotnetDataTypeGenericMVar = DotnetDataType< ElementType::GenericMVar >
 
using DotnetDataTypeCModRequired = DotnetDataType< ElementType::CModRequired >
 
using DotnetDataTypeCModOptional = DotnetDataType< ElementType::CModOptional >
 
using RegisterMap = std::map< std::string, std::uint64_t >
 
using AuxVectorEntry = std::pair< std::uint64_t, std::uint64_t >
 

Enumerations

enum class  Format {
  UNDETECTABLE , UNKNOWN , PE , ELF ,
  COFF , MACHO , INTEL_HEX , RAW_DATA
}
 
enum class  Architecture {
  UNKNOWN , X86 , X86_64 , ARM ,
  POWERPC , MIPS
}
 
enum  LoadFlags { NONE = 0 , NO_FILE_HASHES = 1 , NO_VERBOSE_HASHES = 2 , DETECT_STRINGS = 4 }
 
enum class  MetadataTableType {
  Module = 0 , TypeRef = 1 , TypeDef = 2 , FieldPtr = 3 ,
  Field = 4 , MethodPtr = 5 , MethodDef = 6 , ParamPtr = 7 ,
  Param = 8 , InterfaceImpl = 9 , MemberRef = 10 , Constant = 11 ,
  CustomAttribute = 12 , FieldMarshal = 13 , DeclSecurity = 14 , ClassLayout = 15 ,
  FieldLayout = 16 , StandAloneSig = 17 , EventMap = 18 , Event = 20 ,
  PropertyMap = 21 , PropertyPtr = 22 , Property = 23 , MethodSemantics = 24 ,
  MethodImpl = 25 , ModuleRef = 26 , TypeSpec = 27 , ImplMap = 28 ,
  FieldRVA = 29 , ENCLog = 30 , ENCMap = 31 , Assembly = 32 ,
  AssemblyProcessor = 33 , AssemblyOS = 34 , AssemblyRef = 35 , AssemblyRefProcessor = 36 ,
  AssemblyRefOS = 37 , File = 38 , ExportedType = 39 , ManifestResource = 40 ,
  NestedClass = 41 , GenericParam = 42 , MethodSpec = 43 , GenericParamContstraint = 44
}
 
enum  TypeDefFlags {
  TypeVisibilityMask = 0x00000007 , TypeNotPublic = 0x00000000 , TypePublic = 0x00000001 , TypeNestedPublic = 0x00000002 ,
  TypeNestedPrivate = 0x00000003 , TypeNestedFamily = 0x00000004 , TypeNestedAssembly = 0x00000005 , TypeNestedFamANDAssem = 0x00000006 ,
  TypeNestedFamORAssem = 0x00000007 , TypeClassSemanticsMask = 0x00000020 , TypeClass = 0x00000000 , TypeInterface = 0x00000020 ,
  TypeClassAbstract = 0x00000080 , TypeClassSealed = 0x00000100 , TypeClassSpecialName = 0x00000400 , TypeStringFormatMask = 0x00030000 ,
  TypeAnsiClass = 0x00000000 , TypeUnicodeClass = 0x00010000 , TypeAutoClass = 0x00020000 , TypeCustomFormatClass = 0x00030000
}
 
enum  FieldFlags {
  FieldAccessMask = 0x0007 , FieldCompilerControlled = 0x0000 , FieldPrivate = 0x0001 , FieldFamANDAssem = 0x0002 ,
  FieldAssembly = 0x0003 , FieldFamily = 0x0004 , FieldFamORAssem = 0x0005 , FieldPublic = 0x0006 ,
  FieldStatic = 0x0010 , FieldInitOnly = 0x0020 , FieldLiteral = 0x0040 , FieldNotSerialized = 0x0080 ,
  FieldSpecialName = 0x0200
}
 
enum  MethodFlags {
  MethodMemberAccessMask = 0x0007 , MethodCompilerControlled = 0x0000 , MethodPrivate = 0x0001 , MethodFamANDAssem = 0x0002 ,
  MethodAssem = 0x0003 , MethodFamily = 0x0004 , MethodFamORAssem = 0x0005 , MethodPublic = 0x0006 ,
  MethodStatic = 0x0010 , MethodFinal = 0x0020 , MethodVirtual = 0x0040 , MethodHideBySig = 0x0080 ,
  MethodStrict = 0x0200 , MethodAbstract = 0x0400 , MethodSpecialName = 0x0800
}
 
enum  ParamFlags {
  ParamIn = 0x0001 , ParamOut = 0x0002 , ParamOptional = 0x0010 , ParamHasDefault = 0x1000 ,
  ParamHasFieldMarshal = 0x2000
}
 
enum class  StreamType {
  Metadata , String , UserString , Blob ,
  Guid
}
 
enum class  ElementType {
  End = 0x00 , Void = 0x01 , Boolean = 0x02 , Char = 0x03 ,
  Int8 = 0x04 , UInt8 = 0x05 , Int16 = 0x06 , UInt16 = 0x07 ,
  Int32 = 0x08 , UInt32 = 0x09 , Int64 = 0x0A , UInt64 = 0x0B ,
  Float32 = 0x0C , Float64 = 0x0D , String = 0x0E , Ptr = 0x0F ,
  ByRef = 0x10 , ValueType = 0x11 , Class = 0x12 , GenericVar = 0x13 ,
  Array = 0x14 , GenericInst = 0x15 , TypedByRef = 0x16 , IntPtr = 0x18 ,
  UIntPtr = 0x19 , FnPtr = 0x1B , Object = 0x1C , SzArray = 0x1D ,
  GenericMVar = 0x1E , CModRequired = 0x1F , CModOptional = 0x20 , Internal = 0x21 ,
  Modifier = 0x40 , Sentinel = 0x41 , Pinned = 0x45 , MetaType = 0x50 ,
  BoxedObject = 0x51 , CustomField = 0x53 , CustomProperty = 0x54 , CustomEnum = 0x55
}
 
enum class  DotnetTypeVisibility { Public , Protected , Private }
 
enum  PeImportFlag : std::uint32_t { None = 0 , Delayed = 1 }
 
enum class  CharacterEndianness { Little , Big }
 
enum class  StringType { Ascii , Wide }
 
enum class  VBExternTableEntryType { internal = 0x6 , external = 0x7 }
 
enum class  Asn1Type {
  Null , BitString , OctetString , Sequence ,
  Object , ContextSpecific
}
 

Functions

template<int bits>
bool peSectionName (const PeLib::PeHeaderT< bits > &peHeader, std::string &name, unsigned long long sectionIndex)
 
std::unique_ptr< FileFormatcreateFileFormat (const std::string &filePath, const std::string &dllListFile, bool isRaw=false, LoadFlags loadFlags=LoadFlags::NONE)
 
std::unique_ptr< FileFormatcreateFileFormat (const std::string &filePath, bool isRaw=false, LoadFlags loadFlags=LoadFlags::NONE)
 
std::unique_ptr< FileFormatcreateFileFormat (std::istream &inputStream, bool isRaw=false, LoadFlags loadFlags=LoadFlags::NONE)
 
std::unique_ptr< FileFormatcreateFileFormat (const std::uint8_t *data, std::size_t size, bool isRaw=false, LoadFlags loadFlags=LoadFlags::NONE)
 
template<>
std::uint8_t BaseRecord::loadUInt< std::uint8_t > (const FileFormat *file, std::uint64_t &address)
 
template<>
std::uint16_t BaseRecord::loadUInt< std::uint16_t > (const FileFormat *file, std::uint64_t &address)
 
template<>
std::uint32_t BaseRecord::loadUInt< std::uint32_t > (const FileFormat *file, std::uint64_t &address)
 
template<typename It >
CharacterIterator< It > makeCharacterIterator (It first, It last, std::size_t charStep)
 
template<typename It >
CharacterIterator< It > makeCharacterIterator (It itr, It first, It last, std::size_t charStep)
 
template<typename N >
bool addUniqueValue (std::vector< N > &currentValues, N newVal, std::size_t &newIndex)
 
std::ios_base & hexWithPrefix (std::ios_base &str)
 
std::ios_base & truncFloat (std::ios_base &str)
 
void separateStrings (std::string &str, std::vector< std::string > &words)
 
std::string getCrc32 (const unsigned char *data, std::uint64_t length)
 Count CRC32 of data. More...
 
std::string getMd5 (const unsigned char *data, std::uint64_t length)
 Count MD5 of data. More...
 
std::string getSha1 (const unsigned char *data, std::uint64_t length)
 Count SHA1 of data. More...
 
std::string getSha256 (const unsigned char *data, std::uint64_t length)
 Count SHA256 of data. More...
 
bool readHexString (std::istream &fileStream, std::string &hexa, std::size_t start=0, std::size_t desiredSize=0)
 
bool readPlainString (std::istream &fileStream, std::string &plain, std::size_t start=0, std::size_t desiredSize=0)
 
Format detectFileFormat (const std::string &filePath, bool isRaw=false)
 
Format detectFileFormat (std::istream &inputStream, bool isRaw=false)
 
Format detectFileFormat (const std::uint8_t *data, std::size_t size, bool isRaw=false)
 
std::size_t getRealSizeInRegion (std::size_t offset, std::size_t requestedSize, std::size_t regionSize)
 
std::string getFileFormatNameFromEnum (Format format)
 
std::vector< std::string > getSupportedFileFormats ()
 
std::vector< std::string > getSupportedArchitectures ()
 
std::string lcidToStr (std::size_t lcid)
 
std::string codePageToStr (std::size_t cpage)
 
double computeDataEntropy (const std::uint8_t *data, std::size_t dataLen)
 

Variables

const std::uint64_t MetadataHeaderSignature = 0x424A5342
 
constexpr std::size_t VBHEADER_SIGNATURE = 0x21354256
 
constexpr std::size_t VB_MAX_STRING_LEN = 100
 
const std::uint8_t Asn1TagMask_Class = 0xC0
 
const std::uint8_t Asn1TagMask_Primitive = 0x20
 
const std::uint8_t Asn1TagMask_Type = 0x1F
 
const std::uint8_t Asn1Tag_Universal = 0x00
 
const std::uint8_t Asn1Tag_Application = 0x40
 
const std::uint8_t Asn1Tag_ContextSpecific = 0x80
 
const std::uint8_t Asn1Tag_Private = 0xC0
 
const std::uint8_t Asn1Tag_Constructed = 0x20
 
const std::uint8_t Asn1Tag_BitString = 0x03
 
const std::uint8_t Asn1Tag_OctetString = 0x04
 
const std::uint8_t Asn1Tag_Null = 0x05
 
const std::uint8_t Asn1Tag_Object = 0x06
 
const std::uint8_t Asn1Tag_Sequence = 0x10
 
const std::string DigestAlgorithmOID_Sha1 = "1.3.14.3.2.26"
 
const std::string DigestAlgorithmOID_Sha256 = "2.16.840.1.101.3.4.2.1"
 
const std::string DigestAlgorithmOID_Md5 = "1.2.840.113549.2.5"
 

Typedef Documentation

◆ AuxVectorEntry

using retdec::fileformat::AuxVectorEntry = typedef std::pair<std::uint64_t, std::uint64_t>

◆ DotnetDataTypeArray

◆ DotnetDataTypeBoolean

◆ DotnetDataTypeByRef

◆ DotnetDataTypeChar

◆ DotnetDataTypeClass

◆ DotnetDataTypeCModOptional

◆ DotnetDataTypeCModRequired

◆ DotnetDataTypeEnd

◆ DotnetDataTypeFloat32

◆ DotnetDataTypeFloat64

◆ DotnetDataTypeFnPtr

◆ DotnetDataTypeGenericInst

◆ DotnetDataTypeGenericMVar

◆ DotnetDataTypeGenericVar

◆ DotnetDataTypeInt16

◆ DotnetDataTypeInt32

◆ DotnetDataTypeInt64

◆ DotnetDataTypeInt8

◆ DotnetDataTypeIntPtr

◆ DotnetDataTypeObject

◆ DotnetDataTypePtr

◆ DotnetDataTypeString

◆ DotnetDataTypeSzArray

◆ DotnetDataTypeTypedByRef

◆ DotnetDataTypeUInt16

◆ DotnetDataTypeUInt32

◆ DotnetDataTypeUInt64

◆ DotnetDataTypeUInt8

◆ DotnetDataTypeUIntPtr

◆ DotnetDataTypeValueType

◆ DotnetDataTypeVoid

◆ RegisterMap

using retdec::fileformat::RegisterMap = typedef std::map<std::string, std::uint64_t>

Enumeration Type Documentation

◆ Architecture

Supported architectures

Enumerator
UNKNOWN 
X86 
X86_64 
ARM 
POWERPC 
MIPS 

◆ Asn1Type

Enumerator
Null 
BitString 
OctetString 
Sequence 
Object 
ContextSpecific 

◆ CharacterEndianness

Enumerator
Little 
Big 

◆ DotnetTypeVisibility

.NET type visibility

Enumerator
Public 
Protected 
Private 

◆ ElementType

Enumerator
End 
Void 
Boolean 
Char 
Int8 
UInt8 
Int16 
UInt16 
Int32 
UInt32 
Int64 
UInt64 
Float32 
Float64 
String 
Ptr 
ByRef 
ValueType 
Class 
GenericVar 
Array 
GenericInst 
TypedByRef 
IntPtr 
UIntPtr 
FnPtr 
Object 
SzArray 
GenericMVar 
CModRequired 
CModOptional 
Internal 
Modifier 
Sentinel 
Pinned 
MetaType 
BoxedObject 
CustomField 
CustomProperty 
CustomEnum 

◆ FieldFlags

Enumerator
FieldAccessMask 
FieldCompilerControlled 
FieldPrivate 
FieldFamANDAssem 
FieldAssembly 
FieldFamily 
FieldFamORAssem 
FieldPublic 
FieldStatic 
FieldInitOnly 
FieldLiteral 
FieldNotSerialized 
FieldSpecialName 

◆ Format

Supported file-format types

Enumerator
UNDETECTABLE 
UNKNOWN 
PE 
ELF 
COFF 
MACHO 
INTEL_HEX 
RAW_DATA 

◆ LoadFlags

Enumerator
NONE 
NO_FILE_HASHES 
NO_VERBOSE_HASHES 
DETECT_STRINGS 

◆ MetadataTableType

Enumerator
Module 
TypeRef 
TypeDef 
FieldPtr 
Field 
MethodPtr 
MethodDef 
ParamPtr 
Param 
InterfaceImpl 
MemberRef 
Constant 
CustomAttribute 
FieldMarshal 
DeclSecurity 
ClassLayout 
FieldLayout 
StandAloneSig 
EventMap 
Event 
PropertyMap 
PropertyPtr 
Property 
MethodSemantics 
MethodImpl 
ModuleRef 
TypeSpec 
ImplMap 
FieldRVA 
ENCLog 
ENCMap 
Assembly 
AssemblyProcessor 
AssemblyOS 
AssemblyRef 
AssemblyRefProcessor 
AssemblyRefOS 
File 
ExportedType 
ManifestResource 
NestedClass 
GenericParam 
MethodSpec 
GenericParamContstraint 

◆ MethodFlags

Enumerator
MethodMemberAccessMask 
MethodCompilerControlled 
MethodPrivate 
MethodFamANDAssem 
MethodAssem 
MethodFamily 
MethodFamORAssem 
MethodPublic 
MethodStatic 
MethodFinal 
MethodVirtual 
MethodHideBySig 
MethodStrict 
MethodAbstract 
MethodSpecialName 

◆ ParamFlags

Enumerator
ParamIn 
ParamOut 
ParamOptional 
ParamHasDefault 
ParamHasFieldMarshal 

◆ PeImportFlag

enum retdec::fileformat::PeImportFlag : std::uint32_t
Enumerator
None 
Delayed 

◆ StreamType

Stream type

Enumerator
Metadata 
String 
UserString 
Blob 
Guid 

◆ StringType

Enumerator
Ascii 
Wide 

◆ TypeDefFlags

Enumerator
TypeVisibilityMask 
TypeNotPublic 
TypePublic 
TypeNestedPublic 
TypeNestedPrivate 
TypeNestedFamily 
TypeNestedAssembly 
TypeNestedFamANDAssem 
TypeNestedFamORAssem 
TypeClassSemanticsMask 
TypeClass 
TypeInterface 
TypeClassAbstract 
TypeClassSealed 
TypeClassSpecialName 
TypeStringFormatMask 
TypeAnsiClass 
TypeUnicodeClass 
TypeAutoClass 
TypeCustomFormatClass 

◆ VBExternTableEntryType

Enumerator
internal 
external 

Function Documentation

◆ addUniqueValue()

template<typename N >
bool retdec::fileformat::addUniqueValue ( std::vector< N > &  currentValues,
newVal,
std::size_t &  newIndex 
)

Add newVal to currentValues, if newVal is not stored in currentValues before calling of this function

Parameters
currentValuesVector of current values
newValNew value
newIndexInto this parameter is stored index (indexed from 0) of currentValues at which is newVal
Returns
true if newVal was added to currentValues, false otherwise

◆ BaseRecord::loadUInt< std::uint16_t >()

template<>
std::uint16_t retdec::fileformat::BaseRecord::loadUInt< std::uint16_t > ( const FileFormat file,
std::uint64_t &  address 
)

◆ BaseRecord::loadUInt< std::uint32_t >()

template<>
std::uint32_t retdec::fileformat::BaseRecord::loadUInt< std::uint32_t > ( const FileFormat file,
std::uint64_t &  address 
)

◆ BaseRecord::loadUInt< std::uint8_t >()

template<>
std::uint8_t retdec::fileformat::BaseRecord::loadUInt< std::uint8_t > ( const FileFormat file,
std::uint64_t &  address 
)

◆ codePageToStr()

std::string retdec::fileformat::codePageToStr ( std::size_t  cpage)

Get string representation of IBM code page

Parameters
cpageLanguage code id
Returns
String representation of code page

◆ computeDataEntropy()

double retdec::fileformat::computeDataEntropy ( const std::uint8_t *  data,
std::size_t  dataLen 
)

◆ createFileFormat() [1/4]

std::unique_ptr< FileFormat > retdec::fileformat::createFileFormat ( const std::string &  filePath,
bool  isRaw = false,
LoadFlags  loadFlags = LoadFlags::NONE 
)

◆ createFileFormat() [2/4]

std::unique_ptr< FileFormat > retdec::fileformat::createFileFormat ( const std::string &  filePath,
const std::string &  dllListFile,
bool  isRaw,
LoadFlags  loadFlags 
)

Create instance of FileFormat class

Parameters
filePathPath to input file
dllListFilePath to text file containing list of OS DLLs
isRawIs the input is a raw binary?
loadFlagsLoad flags
Returns
Pointer to instance of FileFormat class or nullptr if any error

If format of input file is not supported, function will return nullptr.

◆ createFileFormat() [3/4]

std::unique_ptr< FileFormat > retdec::fileformat::createFileFormat ( const std::uint8_t *  data,
std::size_t  size,
bool  isRaw = false,
LoadFlags  loadFlags = LoadFlags::NONE 
)

◆ createFileFormat() [4/4]

std::unique_ptr< FileFormat > retdec::fileformat::createFileFormat ( std::istream &  inputStream,
bool  isRaw = false,
LoadFlags  loadFlags = LoadFlags::NONE 
)

◆ detectFileFormat() [1/3]

Format retdec::fileformat::detectFileFormat ( const std::string &  filePath,
bool  isRaw 
)

Detects file format of input file

Parameters
filePathPath to input file
isRawIs the input is a raw binary?
Returns
Detected file format in enumeration representation

◆ detectFileFormat() [2/3]

Format retdec::fileformat::detectFileFormat ( const std::uint8_t *  data,
std::size_t  size,
bool  isRaw = false 
)

◆ detectFileFormat() [3/3]

Format retdec::fileformat::detectFileFormat ( std::istream &  inputStream,
bool  isRaw = false 
)

◆ getCrc32()

std::string retdec::fileformat::getCrc32 ( const unsigned char *  data,
std::uint64_t  length 
)

Count CRC32 of data.

Parameters
[in]dataInput data.
[in]lengthLength of input data.
Returns
CRC32 of input data.

◆ getFileFormatNameFromEnum()

std::string retdec::fileformat::getFileFormatNameFromEnum ( Format  format)

Get file format name

Parameters
formatFile format
Returns
Name of file format

◆ getMd5()

std::string retdec::fileformat::getMd5 ( const unsigned char *  data,
std::uint64_t  length 
)

Count MD5 of data.

Parameters
[in]dataInput data.
[in]lengthLength of input data.
Returns
MD5 of input data.

◆ getRealSizeInRegion()

std::size_t retdec::fileformat::getRealSizeInRegion ( std::size_t  offset,
std::size_t  requestedSize,
std::size_t  regionSize 
)

Get real size of selected area in region

Parameters
offsetStart offset of selected area in region
requestedSizeRequested size of selected area (0 means maximal size from offset to end of region)
regionSizeTotal size of region
Returns
Real size of selected area in region

◆ getSha1()

std::string retdec::fileformat::getSha1 ( const unsigned char *  data,
std::uint64_t  length 
)

Count SHA1 of data.

Parameters
[in]dataInput data.
[in]lengthLength of input data.
Returns
SHA256 of input data.

◆ getSha256()

std::string retdec::fileformat::getSha256 ( const unsigned char *  data,
std::uint64_t  length 
)

Count SHA256 of data.

Parameters
[in]dataInput data.
[in]lengthLength of input data.
Returns
SHA256 of input data.

◆ getSupportedArchitectures()

std::vector< std::string > retdec::fileformat::getSupportedArchitectures ( )

Get list of all supported target architectures

◆ getSupportedFileFormats()

std::vector< std::string > retdec::fileformat::getSupportedFileFormats ( )

Get list of all supported file formats

Returns
List of all supported file formats

◆ hexWithPrefix()

std::ios_base & retdec::fileformat::hexWithPrefix ( std::ios_base &  str)

Formatter for conversions between string and number

◆ lcidToStr()

std::string retdec::fileformat::lcidToStr ( std::size_t  lcid)

Get string representation of language code id

Parameters
lcidLanguage code id
Returns
String representation of lcid

◆ makeCharacterIterator() [1/2]

template<typename It >
CharacterIterator<It> retdec::fileformat::makeCharacterIterator ( It  first,
It  last,
std::size_t  charStep 
)

Creates character iterator pointing to the beginning of the sequence.

Parameters
firstLower bound.
lastUpper bound.
charStepSize of the single character.
Returns
Character iterator.

◆ makeCharacterIterator() [2/2]

template<typename It >
CharacterIterator<It> retdec::fileformat::makeCharacterIterator ( It  itr,
It  first,
It  last,
std::size_t  charStep 
)

Creates character iterator pointing to the specific element of the sequence.

Parameters
itrIterator of element which to point at.
firstLower bound.
lastUpper bound.
charStepSize of the single character.
Returns
Character iterator.

◆ peSectionName()

template<int bits>
bool retdec::fileformat::peSectionName ( const PeLib::PeHeaderT< bits > &  peHeader,
std::string &  name,
unsigned long long  sectionIndex 
)

Get name of selected section

Parameters
peHeaderPE reader
nameParameter for store the result
sectionIndexIndex of selected section (indexed from 0)
Returns
true if section index is valid, false otherwise

◆ readHexString()

bool retdec::fileformat::readHexString ( std::istream &  fileStream,
std::string &  hexa,
std::size_t  start,
std::size_t  desiredSize 
)

Read bytes from file stream and convert them to hexadecimal string representation

Parameters
fileStreamRepresentation of input file
hexaRead bytes in hexadecimal string representation
startStart offset of read
desiredSizeNumber of bytes for read. If this parameter is set to zero, function will read all bytes from start until end of file.
Returns
true if operation went OK, otherwise false

If function returns false, hexa is set to empty string

◆ readPlainString()

bool retdec::fileformat::readPlainString ( std::istream &  fileStream,
std::string &  plain,
std::size_t  start,
std::size_t  desiredSize 
)

Read bytes from file stream as plain text

Parameters
fileStreamRepresentation of input file
plainInto this parameter the resulting string is stored
startStart offset of read
desiredSizeNumber of bytes for read. If this parameter is set to zero, function will read all bytes from start until end of file.
Returns
true if operation went OK, otherwise false

If function returns false, plain is set to empty string

◆ separateStrings()

void retdec::fileformat::separateStrings ( std::string &  str,
std::vector< std::string > &  words 
)

Divide str into individual strings separated by a null character ('\0')

Parameters
strInput string
wordsInto this parameter the separated strings are saved

At start of this function, everything from vector words is deleted.

Into words is stored each word (chunk of text), which contain at least one character with different value than '\0' (words containing only null character are eliminated). Null character at end of each stored word is erased.

◆ truncFloat()

std::ios_base & retdec::fileformat::truncFloat ( std::ios_base &  str)

Formatter for truncated real numbers

Variable Documentation

◆ Asn1Tag_Application

const std::uint8_t retdec::fileformat::Asn1Tag_Application = 0x40

◆ Asn1Tag_BitString

const std::uint8_t retdec::fileformat::Asn1Tag_BitString = 0x03

◆ Asn1Tag_Constructed

const std::uint8_t retdec::fileformat::Asn1Tag_Constructed = 0x20

◆ Asn1Tag_ContextSpecific

const std::uint8_t retdec::fileformat::Asn1Tag_ContextSpecific = 0x80

◆ Asn1Tag_Null

const std::uint8_t retdec::fileformat::Asn1Tag_Null = 0x05

◆ Asn1Tag_Object

const std::uint8_t retdec::fileformat::Asn1Tag_Object = 0x06

◆ Asn1Tag_OctetString

const std::uint8_t retdec::fileformat::Asn1Tag_OctetString = 0x04

◆ Asn1Tag_Private

const std::uint8_t retdec::fileformat::Asn1Tag_Private = 0xC0

◆ Asn1Tag_Sequence

const std::uint8_t retdec::fileformat::Asn1Tag_Sequence = 0x10

◆ Asn1Tag_Universal

const std::uint8_t retdec::fileformat::Asn1Tag_Universal = 0x00

◆ Asn1TagMask_Class

const std::uint8_t retdec::fileformat::Asn1TagMask_Class = 0xC0

◆ Asn1TagMask_Primitive

const std::uint8_t retdec::fileformat::Asn1TagMask_Primitive = 0x20

◆ Asn1TagMask_Type

const std::uint8_t retdec::fileformat::Asn1TagMask_Type = 0x1F

◆ DigestAlgorithmOID_Md5

const std::string retdec::fileformat::DigestAlgorithmOID_Md5 = "1.2.840.113549.2.5"

◆ DigestAlgorithmOID_Sha1

const std::string retdec::fileformat::DigestAlgorithmOID_Sha1 = "1.3.14.3.2.26"

◆ DigestAlgorithmOID_Sha256

const std::string retdec::fileformat::DigestAlgorithmOID_Sha256 = "2.16.840.1.101.3.4.2.1"

◆ MetadataHeaderSignature

const std::uint64_t retdec::fileformat::MetadataHeaderSignature = 0x424A5342

◆ VB_MAX_STRING_LEN

constexpr std::size_t retdec::fileformat::VB_MAX_STRING_LEN = 100
constexpr

◆ VBHEADER_SIGNATURE

constexpr std::size_t retdec::fileformat::VBHEADER_SIGNATURE = 0x21354256
constexpr