retdec
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
retdec::bin2llvmir::MainDetection Class Reference

#include <main_detection.h>

Inheritance diagram for retdec::bin2llvmir::MainDetection:
Inheritance graph
[legend]
Collaboration diagram for retdec::bin2llvmir::MainDetection:
Collaboration graph
[legend]

Public Member Functions

 MainDetection ()
 
virtual bool runOnModule (llvm::Module &M) override
 
bool runOnModuleCustom (llvm::Module &m, Config *c, FileImage *img=nullptr, NameContainer *names=nullptr)
 

Static Public Attributes

static char ID = 0
 

Private Member Functions

bool run ()
 
bool skipAnalysis ()
 
void removeStaticallyLinked ()
 
retdec::common::Address getFromFunctionNames ()
 
retdec::common::Address getFromContext ()
 
retdec::common::Address getFromEntryPointOffset (int offset)
 
retdec::common::Address getFromCrtSetCheckCount ()
 
retdec::common::Address getFromInterlockedExchange ()
 
bool applyResult (retdec::common::Address mainAddr)
 

Private Attributes

llvm::Module * _module = nullptr
 
Config_config = nullptr
 
FileImage_image = nullptr
 
NameContainer_names = nullptr
 

Constructor & Destructor Documentation

◆ MainDetection()

retdec::bin2llvmir::MainDetection::MainDetection ( )

Member Function Documentation

◆ applyResult()

bool retdec::bin2llvmir::MainDetection::applyResult ( retdec::common::Address  mainAddr)
private

◆ getFromContext()

retdec::common::Address retdec::bin2llvmir::MainDetection::getFromContext ( )
private

◆ getFromCrtSetCheckCount()

retdec::common::Address retdec::bin2llvmir::MainDetection::getFromCrtSetCheckCount ( )
private

Try to find main call at _CrtSetCheckCount + 0x2B. Detect if main is called through wrapper.

◆ getFromEntryPointOffset()

retdec::common::Address retdec::bin2llvmir::MainDetection::getFromEntryPointOffset ( int  offset)
private

TODO: maybe add wrapper handling as in other functions.

◆ getFromFunctionNames()

retdec::common::Address retdec::bin2llvmir::MainDetection::getFromFunctionNames ( )
private

◆ getFromInterlockedExchange()

retdec::common::Address retdec::bin2llvmir::MainDetection::getFromInterlockedExchange ( )
private

Try to find main call at InterlockedExchange + 0x46. Detect if main is called through wrapper.

◆ removeStaticallyLinked()

void retdec::bin2llvmir::MainDetection::removeStaticallyLinked ( )
private

Delete statically linked functions bodies only after main detection run. TODO: This is not ideal here, very random, move main detection to decoding? and delete linked bodies right after they have been found? TODO: do this when shared?

◆ run()

bool retdec::bin2llvmir::MainDetection::run ( )
private

◆ runOnModule()

bool retdec::bin2llvmir::MainDetection::runOnModule ( llvm::Module &  M)
overridevirtual

◆ runOnModuleCustom()

bool retdec::bin2llvmir::MainDetection::runOnModuleCustom ( llvm::Module &  m,
Config c,
FileImage img = nullptr,
NameContainer names = nullptr 
)

◆ skipAnalysis()

bool retdec::bin2llvmir::MainDetection::skipAnalysis ( )
private

Member Data Documentation

◆ _config

Config* retdec::bin2llvmir::MainDetection::_config = nullptr
private

◆ _image

FileImage* retdec::bin2llvmir::MainDetection::_image = nullptr
private

◆ _module

llvm::Module* retdec::bin2llvmir::MainDetection::_module = nullptr
private

◆ _names

NameContainer* retdec::bin2llvmir::MainDetection::_names = nullptr
private

◆ ID

char retdec::bin2llvmir::MainDetection::ID = 0
static

The documentation for this class was generated from the following files: