retdec
|
#include <dotnet_type_reconstructor.h>
Public Types | |
using | ClassList = std::vector< std::shared_ptr< DotnetClass > > |
using | ClassTable = std::map< std::size_t, std::shared_ptr< DotnetClass > > |
using | ClassToMethodTable = std::unordered_map< const DotnetClass *, std::vector< std::unique_ptr< DotnetMethod > >> |
using | MethodTable = std::map< std::size_t, DotnetMethod * > |
using | SignatureTable = std::map< const DotnetMethod *, std::vector< std::uint8_t > > |
Public Member Functions | |
DotnetTypeReconstructor (const MetadataStream *metadata, const StringStream *strings, const BlobStream *blob) | |
bool | reconstruct () |
ClassList | getDefinedClasses () const |
ClassList | getReferencedClasses () const |
Private Member Functions | |
bool | reconstructClasses () |
bool | reconstructMethods () |
bool | reconstructGenericParameters () |
bool | reconstructMethodParameters () |
bool | reconstructFields () |
bool | reconstructProperties () |
bool | reconstructNestedClasses () |
bool | reconstructBaseTypes () |
void | linkReconstructedClasses () |
void | linkReconstructedClassesDo (size_t i, std::vector< bool > &visited, std::vector< bool > &stack, ClassList &refClasses, const MetadataTable< TypeRef > *typeRefTable) |
std::unique_ptr< DotnetClass > | createClassDefinition (const TypeDef *typeDef, std::size_t fieldsCount, std::size_t methodsCount, std::size_t typeDefIndex) |
std::unique_ptr< DotnetClass > | createClassReference (const TypeRef *typeRef, std::size_t typeRefIndex) |
std::unique_ptr< DotnetField > | createField (const Field *field, const DotnetClass *ownerClass) |
std::unique_ptr< DotnetProperty > | createProperty (const Property *property, const DotnetClass *ownerClass) |
std::unique_ptr< DotnetMethod > | createMethod (const MethodDef *methodDef, const DotnetClass *ownerClass) |
std::unique_ptr< DotnetParameter > | createMethodParameter (const Param *param, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod, std::vector< std::uint8_t > &signature) |
template<typename T > | |
std::unique_ptr< T > | createDataTypeFollowedByReference (std::vector< std::uint8_t > &data) |
template<typename T > | |
std::unique_ptr< T > | createDataTypeFollowedByType (std::vector< std::uint8_t > &data, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
template<typename T , typename U > | |
std::unique_ptr< T > | createGenericReference (std::vector< std::uint8_t > &data, const U *owner) |
std::unique_ptr< DotnetDataTypeGenericInst > | createGenericInstantiation (std::vector< std::uint8_t > &data, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
std::unique_ptr< DotnetDataTypeArray > | createArray (std::vector< std::uint8_t > &data, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
template<typename T > | |
std::unique_ptr< T > | createModifier (std::vector< std::uint8_t > &data, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
std::unique_ptr< DotnetDataTypeFnPtr > | createFnPtr (std::vector< std::uint8_t > &data, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
std::unique_ptr< DotnetDataTypeBase > | dataTypeFromSignature (std::vector< std::uint8_t > &signature, const DotnetClass *ownerClass, const DotnetMethod *ownerMethod) |
const DotnetClass * | selectClass (const TypeDefOrRef &typeDefOrRef) const |
Private Attributes | |
const MetadataStream * | metadataStream |
const StringStream * | stringStream |
const BlobStream * | blobStream |
ClassTable | defClassTable |
ClassTable | refClassTable |
MethodTable | methodTable |
ClassToMethodTable | classToMethodTable |
SignatureTable | methodReturnTypeAndParamTypeTable |
using retdec::fileformat::DotnetTypeReconstructor::ClassList = std::vector<std::shared_ptr<DotnetClass> > |
using retdec::fileformat::DotnetTypeReconstructor::ClassTable = std::map<std::size_t, std::shared_ptr<DotnetClass> > |
using retdec::fileformat::DotnetTypeReconstructor::ClassToMethodTable = std::unordered_map<const DotnetClass*, std::vector<std::unique_ptr<DotnetMethod> >> |
using retdec::fileformat::DotnetTypeReconstructor::MethodTable = std::map<std::size_t, DotnetMethod*> |
using retdec::fileformat::DotnetTypeReconstructor::SignatureTable = std::map<const DotnetMethod*, std::vector<std::uint8_t> > |
retdec::fileformat::DotnetTypeReconstructor::DotnetTypeReconstructor | ( | const MetadataStream * | metadata, |
const StringStream * | strings, | ||
const BlobStream * | blob | ||
) |
Constructor.
metadata | Metadata stream. |
strings | String stream. |
blob | Blob stream. |
|
private |
Creates data type from signature that represent array.
data | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure.
|
private |
|
private |
|
private |
Creates data type from signature that references defined or imported class.
data | Signature data. |
nullptr
in case of failure.
|
private |
Creates data type from signature that refers to another data type.
data | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure.
|
private |
|
private |
Creates data type from signature that represents function pointer.
data | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure.
|
private |
Creates data type from signature that instantiates generic data type.
data | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure.
|
private |
Creates data type from signature that references generic parameter.
data | Signature data. |
owner | Owning class or method. |
nullptr
in case of failure.
|
private |
|
private |
|
private |
Creates data type from signature that represent type modifier.
data | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure.
|
private |
|
private |
Creates data type from signature. Signature is destroyed in the meantime.
signature | Signature data. |
ownerClass | Owning class. |
ownerMethod | Owning method. |
nullptr
in case of failure. DotnetTypeReconstructor::ClassList retdec::fileformat::DotnetTypeReconstructor::getDefinedClasses | ( | ) | const |
Returns the defined classes.
DotnetTypeReconstructor::ClassList retdec::fileformat::DotnetTypeReconstructor::getReferencedClasses | ( | ) | const |
Returns the referenced (imported) classes.
|
private |
Links referenced (imported) classes.
|
private |
Helper function for linkReconstructedClasses()
i | Index of a class to be linked. |
visited | Visited flags for cyclic linkage detection. |
stack | Recent traversal stack for cyclic linkage detection. |
refClasses | List of imported classes. |
typeRefTable | Typeref table. |
bool retdec::fileformat::DotnetTypeReconstructor::reconstruct | ( | ) |
Reconstructs classes, methods, fields, properties and class hierarchy.
true
if reconstruction was successful, otherwise false
.
|
private |
Reconstructs base types of classes.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs defined and referenced (imported) classes and interfaces.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs fields of classes.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs generic parameters of classes and methods.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs parameters of methods.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs methods in the classes and interfaces. Method parameters are not reconstructed here.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs namespaces of nested classes.
true
if reconstruction successful, otherwise false
.
|
private |
Reconstructs fields of classes.
true
if reconstruction successful, otherwise false
.
|
private |
Selects a class from defined or referenced class table based on provided TypeDefOrRef
index.
typeDefOrRef | Index. |
nullptr
.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |