mirror of
https://github.com/Obfuscator-Collections/VMProtect.git
synced 2026-09-03 22:11:54 +03:00
first commit
Version 3.x.x
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
[TestLicense]
|
||||
AcceptedSerialNumber=SerialNumber
|
||||
UserName=VMProtect Software
|
||||
EMail=info@vmpsoft.com
|
||||
MyHWID=+L7reY1X2iCLr+TKSsVHtQ==
|
||||
UserData=00
|
||||
+3625
File diff suppressed because it is too large
Load Diff
+598
@@ -0,0 +1,598 @@
|
||||
#ifndef CORE_H
|
||||
#define CORE_H
|
||||
|
||||
#include "../runtime/common.h"
|
||||
|
||||
enum ProjectOption {
|
||||
cpDebugMode = 0x00000002,
|
||||
cpCryptValues = 0x00000008,
|
||||
cpIncludeWatermark = 0x00000020,
|
||||
cpRunnerCRC = 0x00000040,
|
||||
cpEncryptRegs = 0x00000080,
|
||||
cpStripFixups = 0x00008000,
|
||||
cpPack = 0x00000100,
|
||||
cpImportProtection = 0x00000200,
|
||||
cpCheckDebugger = 0x00000400,
|
||||
cpCheckVirtualMachine = 0x00000800,
|
||||
cpMemoryProtection = 0x00001000,
|
||||
cpResourceProtection = 0x00010000,
|
||||
cpCheckKernelDebugger = 0x00020000,
|
||||
cpStripDebugInfo = 0x00040000,
|
||||
|
||||
cpLoaderCRC = 0x10000000,
|
||||
#ifndef DEMO
|
||||
cpUnregisteredVersion = 0x40000000,
|
||||
#endif
|
||||
cpEncryptBytecode = 0x80000000,
|
||||
cpVirtualFiles = 0x08000000,
|
||||
cpInternalMemoryProtection = 0x04000000,
|
||||
cpLoader = 0x02000000,
|
||||
cpMaximumProtection = cpCryptValues | cpRunnerCRC | cpEncryptRegs | cpPack | cpImportProtection | cpMemoryProtection | cpResourceProtection | cpStripDebugInfo,
|
||||
cpUserOptionsMask = 0x00FFFFFF
|
||||
};
|
||||
|
||||
std::string VectorToBase64(const std::vector<uint8_t> &src);
|
||||
|
||||
static const VMP_CHAR *default_message[MESSAGE_COUNT] =
|
||||
{
|
||||
MESSAGE_DEBUGGER_FOUND_STR,
|
||||
MESSAGE_VIRTUAL_MACHINE_FOUND_STR,
|
||||
MESSAGE_FILE_CORRUPTED_STR,
|
||||
MESSAGE_SERIAL_NUMBER_REQUIRED_STR,
|
||||
MESSAGE_HWID_MISMATCHED_STR
|
||||
};
|
||||
|
||||
struct LicenseDate {
|
||||
uint16_t Year;
|
||||
uint8_t Month;
|
||||
uint8_t Day;
|
||||
LicenseDate(uint32_t value = 0)
|
||||
{
|
||||
Day = value & 0xff;
|
||||
Month = (value >> 8) & 0xff;
|
||||
Year = (value >> 16) & 0xffff;
|
||||
};
|
||||
LicenseDate(uint16_t year, uint8_t month, uint8_t day)
|
||||
: Year(year), Month(month), Day(day) {};
|
||||
uint32_t value() const { return (Year << 16) | (Month << 8) | Day; }
|
||||
};
|
||||
|
||||
class Core;
|
||||
class BigNumber;
|
||||
class ProjectTemplate;
|
||||
class ProjectTemplateManager;
|
||||
|
||||
class RSA
|
||||
{
|
||||
public:
|
||||
RSA();
|
||||
RSA(const std::vector<uint8_t> &public_exp, const std::vector<uint8_t> &private_exp, const std::vector<uint8_t> &modulus);
|
||||
~RSA();
|
||||
bool Encrypt(Data &data);
|
||||
bool Decrypt(Data &data);
|
||||
bool CreateKeyPair(size_t key_length);
|
||||
std::vector<uint8_t> public_exp() const;
|
||||
std::vector<uint8_t> private_exp() const;
|
||||
std::vector<uint8_t> modulus() const;
|
||||
private:
|
||||
BigNumber *private_exp_;
|
||||
BigNumber *public_exp_;
|
||||
BigNumber *modulus_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
RSA(const RSA &);
|
||||
RSA &operator =(const RSA &);
|
||||
};
|
||||
|
||||
#ifdef ULTIMATE
|
||||
class LicensingManager;
|
||||
|
||||
struct LicenseInfo {
|
||||
uint32_t Flags;
|
||||
std::string CustomerName;
|
||||
std::string CustomerEmail;
|
||||
LicenseDate ExpireDate;
|
||||
std::string HWID;
|
||||
uint8_t RunningTimeLimit;
|
||||
LicenseDate MaxBuildDate;
|
||||
std::string UserData;
|
||||
LicenseInfo() : Flags(0), RunningTimeLimit(0) {}
|
||||
};
|
||||
|
||||
class License: public IObject
|
||||
{
|
||||
public:
|
||||
explicit License(LicensingManager *owner, LicenseDate date, const std::string &customer_name, const std::string &customer_email, const std::string &order_ref,
|
||||
const std::string &comments, const std::string &serial_number, bool blocked);
|
||||
~License();
|
||||
std::string customer_name() const { return customer_name_; }
|
||||
std::string customer_email() const { return customer_email_; }
|
||||
std::string order_ref() const { return order_ref_; }
|
||||
std::string comments() const { return comments_; }
|
||||
std::string serial_number() const { return serial_number_; }
|
||||
bool blocked() const { return blocked_; }
|
||||
void GetHash(uint8_t hash[20]);
|
||||
LicenseDate date() const { return date_; }
|
||||
void set_customer_name(const std::string &value);
|
||||
void set_customer_email(const std::string &value);
|
||||
void set_order_ref(const std::string &value);
|
||||
void set_date(LicenseDate value);
|
||||
void set_comments(const std::string &value);
|
||||
void set_blocked( bool value);
|
||||
LicenseInfo *info();
|
||||
void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
private:
|
||||
LicensingManager *owner_;
|
||||
LicenseDate date_;
|
||||
std::string customer_name_;
|
||||
std::string customer_email_;
|
||||
std::string order_ref_;
|
||||
std::string comments_;
|
||||
std::string serial_number_;
|
||||
bool blocked_;
|
||||
LicenseInfo *info_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
License(const License &);
|
||||
License &operator =(const License &);
|
||||
};
|
||||
|
||||
enum Algorithm {
|
||||
alNone,
|
||||
alRSA
|
||||
};
|
||||
|
||||
enum SerialNumberFlags {
|
||||
HAS_USER_NAME = 0x0001,
|
||||
HAS_EMAIL = 0x0002,
|
||||
HAS_EXP_DATE = 0x0004,
|
||||
HAS_MAX_BUILD_DATE = 0x0008,
|
||||
HAS_TIME_LIMIT = 0x0010,
|
||||
HAS_HARDWARE_ID = 0x0020,
|
||||
HAS_USER_DATA = 0x0040,
|
||||
SN_FLAGS_PADDING = 0xFFFF
|
||||
};
|
||||
|
||||
class LicensingManager : public ObjectList<License>
|
||||
{
|
||||
public:
|
||||
explicit LicensingManager(Core *owner = NULL);
|
||||
virtual bool GetLicenseData(Data &data) const;
|
||||
virtual void clear();
|
||||
bool Open(const std::string &file_name);
|
||||
bool Save();
|
||||
bool SaveAs(const std::string &file_name);
|
||||
bool empty() const { return algorithm_ == alNone; }
|
||||
uint64_t product_code() const;
|
||||
bool Init(size_t key_len);
|
||||
Algorithm algorithm() const { return algorithm_; }
|
||||
uint16_t bits() const { return bits_; }
|
||||
std::vector<uint8_t> public_exp() const { return public_exp_; }
|
||||
std::vector<uint8_t> private_exp() const { return private_exp_; }
|
||||
std::vector<uint8_t> modulus() const { return modulus_; }
|
||||
std::vector<uint8_t> hash() const;
|
||||
std::string activation_server() const { return activation_server_; }
|
||||
void set_activation_server(const std::string &activation_server) { activation_server_ = activation_server; }
|
||||
void set_build_date(uint32_t build_date) { build_date_ = build_date; }
|
||||
std::string GenerateSerialNumber(const LicenseInfo &license_info);
|
||||
bool DecryptSerialNumber(const std::string &serial_number, LicenseInfo &license_info);
|
||||
License *Add(LicenseDate date, const std::string &customer_name, const std::string &customer_email, const std::string &order_ref,
|
||||
const std::string &comments, const std::string &serial_number, bool blocked);
|
||||
License *GetLicenseBySerialNumber(const std::string &serial_number);
|
||||
bool CompareParameters(const LicensingManager &manager) const;
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
virtual void AddObject(License *license);
|
||||
virtual void RemoveObject(License *license);
|
||||
private:
|
||||
void changed();
|
||||
Core *owner_;
|
||||
std::string file_name_;
|
||||
Algorithm algorithm_;
|
||||
uint16_t bits_;
|
||||
std::vector<uint8_t> public_exp_;
|
||||
std::vector<uint8_t> private_exp_;
|
||||
std::vector<uint8_t> modulus_;
|
||||
std::vector<uint8_t> product_code_;
|
||||
std::string activation_server_;
|
||||
uint32_t build_date_;
|
||||
};
|
||||
|
||||
class FileManager;
|
||||
class IFunction;
|
||||
class FileStream;
|
||||
|
||||
class FileFolder : public ObjectList<FileFolder>
|
||||
{
|
||||
public:
|
||||
explicit FileFolder(FileFolder *owner, const std::string &name);
|
||||
explicit FileFolder(FileFolder *owner, const FileFolder &src);
|
||||
virtual ~FileFolder();
|
||||
FileFolder *Clone(FileFolder *owner) const;
|
||||
FileFolder *Add(const std::string &name);
|
||||
std::string name() const { return name_; }
|
||||
FileFolder *owner() const { return owner_; }
|
||||
void set_name(const std::string &name);
|
||||
void set_owner(FileFolder *owner);
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
std::string id() const;
|
||||
FileFolder *GetFolderById(const std::string &id) const;
|
||||
void WriteEntry(IFunction &data);
|
||||
void WriteName(IFunction &data, uint64_t image_base, uint32_t key);
|
||||
using IObject::CompareWith;
|
||||
private:
|
||||
void changed();
|
||||
FileFolder *owner_;
|
||||
std::string name_;
|
||||
size_t entry_offset_;
|
||||
};
|
||||
|
||||
class FileFolderList : public FileFolder
|
||||
{
|
||||
public:
|
||||
explicit FileFolderList(FileManager *owner);
|
||||
explicit FileFolderList(FileManager *owner, const FileFolderList &src);
|
||||
FileFolderList *Clone(FileManager *owner) const;
|
||||
std::vector<FileFolder*> GetFolderList() const;
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
FileManager *owner() const { return owner_; }
|
||||
private:
|
||||
FileManager *owner_;
|
||||
};
|
||||
|
||||
enum InternalFileAction {
|
||||
faNone,
|
||||
faLoad,
|
||||
faRegister,
|
||||
faInstall
|
||||
};
|
||||
|
||||
class InternalFile : public IObject
|
||||
{
|
||||
public:
|
||||
InternalFile(FileManager *owner, const std::string &name, const std::string &file_name, InternalFileAction action, FileFolder *folder);
|
||||
~InternalFile();
|
||||
std::string name() const { return name_; }
|
||||
std::string file_name() const { return file_name_; }
|
||||
std::string absolute_file_name() const;
|
||||
void set_name(const std::string &value);
|
||||
void set_file_name(const std::string &value);
|
||||
bool Open();
|
||||
void Close();
|
||||
virtual void WriteEntry(IFunction &func);
|
||||
virtual void WriteName(IFunction &func, uint64_t image_base, uint32_t key);
|
||||
virtual void WriteData(IFunction &func, uint64_t image_base, uint32_t key);
|
||||
void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
FileManager *owner() const { return owner_; }
|
||||
InternalFileAction action() const { return action_; }
|
||||
void set_action(InternalFileAction action);
|
||||
bool is_server() const { return (action_ == faRegister || action_ == faInstall); }
|
||||
FileFolder *folder() const { return folder_; }
|
||||
void set_folder(FileFolder *folder);
|
||||
size_t id() const;
|
||||
FileStream *stream() const { return stream_; }
|
||||
private:
|
||||
FileManager *owner_;
|
||||
std::string name_;
|
||||
std::string file_name_;
|
||||
InternalFileAction action_;
|
||||
FileStream *stream_;
|
||||
size_t entry_offset_;
|
||||
FileFolder *folder_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
InternalFile(const InternalFile &);
|
||||
InternalFile &operator =(const InternalFile &);
|
||||
};
|
||||
|
||||
class FileManager : public ObjectList<InternalFile>
|
||||
{
|
||||
public:
|
||||
FileManager(Core *owner);
|
||||
~FileManager();
|
||||
virtual void clear();
|
||||
bool need_compile() const { return need_compile_; }
|
||||
void set_need_compile(bool need_compile);
|
||||
InternalFile *Add(const std::string &name, const std::string &file_name, InternalFileAction action, FileFolder *folder);
|
||||
bool OpenFiles();
|
||||
void CloseFiles();
|
||||
void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
Core *owner() const { return owner_; }
|
||||
uint32_t GetRuntimeOptions() const;
|
||||
size_t server_count() const;
|
||||
FileFolderList *folder_list() const { return folder_list_; }
|
||||
private:
|
||||
Core *owner_;
|
||||
bool need_compile_;
|
||||
FileFolderList *folder_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
FileManager(const FileManager &);
|
||||
FileManager &operator =(const FileManager &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class WatermarkManager;
|
||||
class IniFile;
|
||||
class SettingsFile;
|
||||
|
||||
class Watermark : public IObject
|
||||
{
|
||||
public:
|
||||
Watermark(WatermarkManager *owner);
|
||||
Watermark(WatermarkManager *owner, const std::string &name, const std::string &value, size_t use_count, bool enabled);
|
||||
~Watermark();
|
||||
size_t id() const { return id_; }
|
||||
std::string name() const { return name_; }
|
||||
bool enabled() const { return enabled_; }
|
||||
std::string value() const { return value_; }
|
||||
size_t use_count() const { return use_count_; }
|
||||
void set_name(const std::string &name);
|
||||
void set_value(const std::string &value);
|
||||
void set_enabled(bool value);
|
||||
void Compile();
|
||||
bool SearchByte(uint8_t value);
|
||||
std::vector<uint8_t> dump() const { return dump_; }
|
||||
void inc_use_count();
|
||||
void ReadFromIni(IniFile &file, size_t id);
|
||||
void ReadFromNode(TiXmlElement *node);
|
||||
void SaveToNode(TiXmlElement *node);
|
||||
void SaveToFile(SettingsFile &file);
|
||||
void DeleteFromFile(SettingsFile &file);
|
||||
void InitSearch() { pos_.clear(); }
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
static bool AreSimilar(const std::string &v1, const std::string &v2);
|
||||
static bool SymbolsMatch(char v1, char v2);
|
||||
private:
|
||||
WatermarkManager *owner_;
|
||||
size_t id_;
|
||||
std::string name_;
|
||||
std::string value_;
|
||||
size_t use_count_;
|
||||
bool enabled_;
|
||||
std::vector<uint8_t> dump_;
|
||||
std::vector<uint8_t> mask_;
|
||||
std::vector<size_t> pos_;
|
||||
};
|
||||
|
||||
class WatermarkManager : public ObjectList<Watermark>
|
||||
{
|
||||
public:
|
||||
WatermarkManager(Core *owner);
|
||||
Watermark *Add(const std::string name, const std::string value, size_t use_count = 0, bool enabled = true);
|
||||
Watermark *GetWatermarkByName(const std::string &name);
|
||||
void InitSearch() const;
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
void ReadFromFile(SettingsFile &file);
|
||||
virtual void RemoveObject(Watermark *watermark);
|
||||
void ReadFromIni(const std::string &file_name);
|
||||
void SaveToFile(SettingsFile &file);
|
||||
std::string CreateValue() const;
|
||||
Watermark *GetWatermarkByValue(const std::string &value) const;
|
||||
bool IsUniqueWatermark(const std::string &value) const;
|
||||
private:
|
||||
Core *owner_;
|
||||
};
|
||||
|
||||
enum VMProtectProductId
|
||||
{
|
||||
VPI_NOT_SPECIFIED, //0 legacy
|
||||
VPI_LITE_WIN_PERSONAL, //1 VMProtect Lite for Windows (Personal License)
|
||||
VPI_LITE_WIN_COMPANY, //2 VMProtect Lite for Windows (Company License)
|
||||
VPI_PROF_WIN_PERSONAL, //3 VMProtect Professional for Windows (Personal License)
|
||||
VPI_PROF_WIN_COMPANY, //4 VMProtect Professional for Windows (Company License)
|
||||
VPI_ULTM_WIN_PERSONAL, //5 VMProtect Ultimate for Windows (Personal License)
|
||||
VPI_ULTM_WIN_COMPANY, //6 VMProtect Ultimate for Windows (Company License)
|
||||
VPI_LITE_OSX_PERSONAL, //7 VMProtect Lite for Mac OS X (Personal License)
|
||||
VPI_LITE_OSX_COMPANY, //8 VMProtect Lite for Mac OS X (Company License)
|
||||
VPI_PROF_OSX_PERSONAL, //9 VMProtect Professional for Mac OS X (Personal License)
|
||||
VPI_PROF_OSX_COMPANY, //10 VMProtect Professional for Mac OS X (Company License)
|
||||
VPI_ULTM_OSX_PERSONAL, //11 VMProtect Ultimate for Mac OS X (Personal License)
|
||||
VPI_ULTM_OSX_COMPANY, //12 VMProtect Ultimate for Mac OS X (Company License)
|
||||
VPI_WLM_PERSONAL, //13 VMProtect Web License Manager (Personal License)
|
||||
VPI_WLM_COMPANY, //14 VMProtect Web License Manager (Company License)
|
||||
VPI_YEAR_PESONAL, //15 Yearly Subscription Plan (Personal License)
|
||||
VPI_YEAR_COMPANY, //16 Yearly Subscription Plan (Company License)
|
||||
VPI_SENS_WIN_PERSONAL, //17 VMProtect SE for Windows (Personal License)
|
||||
VPI_SENS_WIN_COMPANY, //18 VMProtect SE for Windows (Company License)
|
||||
VPI_LITE_LIN_PERSONAL, //19 VMProtect Lite for Linux (Personal License)
|
||||
VPI_LITE_LIN_COMPANY, //20 VMProtect Lite for Linux (Company License)
|
||||
VPI_PROF_LIN_PERSONAL, //21 VMProtect Professional for Linux (Personal License)
|
||||
VPI_PROF_LIN_COMPANY, //22 VMProtect Professional for Linux (Company License)
|
||||
VPI_ULTM_LIN_PERSONAL, //23 VMProtect Ultimate for Linux (Personal License)
|
||||
VPI_ULTM_LIN_COMPANY, //24 VMProtect Ultimate for Linux (Company License)
|
||||
#ifdef __unix__
|
||||
VPI_LITE_PERSONAL = VPI_LITE_LIN_PERSONAL,
|
||||
VPI_LITE_COMPANY = VPI_LITE_LIN_COMPANY,
|
||||
VPI_PROF_PERSONAL = VPI_PROF_LIN_PERSONAL,
|
||||
VPI_PROF_COMPANY = VPI_PROF_LIN_COMPANY,
|
||||
VPI_ULTM_PERSONAL = VPI_ULTM_LIN_PERSONAL,
|
||||
VPI_ULTM_COMPANY = VPI_ULTM_LIN_COMPANY,
|
||||
#elif defined(__APPLE__)
|
||||
VPI_LITE_PERSONAL = VPI_LITE_OSX_PERSONAL,
|
||||
VPI_LITE_COMPANY = VPI_LITE_OSX_COMPANY,
|
||||
VPI_PROF_PERSONAL = VPI_PROF_OSX_PERSONAL,
|
||||
VPI_PROF_COMPANY = VPI_PROF_OSX_COMPANY,
|
||||
VPI_ULTM_PERSONAL = VPI_ULTM_OSX_PERSONAL,
|
||||
VPI_ULTM_COMPANY = VPI_ULTM_OSX_COMPANY,
|
||||
#else
|
||||
VPI_LITE_PERSONAL = VPI_LITE_WIN_PERSONAL,
|
||||
VPI_LITE_COMPANY = VPI_LITE_WIN_COMPANY,
|
||||
VPI_PROF_PERSONAL = VPI_PROF_WIN_PERSONAL,
|
||||
VPI_PROF_COMPANY = VPI_PROF_WIN_COMPANY,
|
||||
VPI_ULTM_PERSONAL = VPI_ULTM_WIN_PERSONAL,
|
||||
VPI_ULTM_COMPANY = VPI_ULTM_WIN_COMPANY,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(ULTIMATE)
|
||||
#define EDITION "Ultimate"
|
||||
#elif defined(LITE)
|
||||
#define EDITION "Lite"
|
||||
#else
|
||||
#define EDITION "Professional"
|
||||
#endif
|
||||
|
||||
#define STR_HELPER(x) #x
|
||||
#define STR(x) STR_HELPER(x)
|
||||
|
||||
#define STR_HELPERW(x) L ## #x
|
||||
#define STRW(x) STR_HELPERW(x)
|
||||
#define STR_HELPERWQ(x) L ## x
|
||||
#define STRWQ(x) STR_HELPERWQ(x)
|
||||
|
||||
class ProjectTemplate : public IObject
|
||||
{
|
||||
public:
|
||||
ProjectTemplate(ProjectTemplateManager *owner, const std::string &name, bool is_default = false);
|
||||
ProjectTemplate &operator =(const ProjectTemplate &);
|
||||
~ProjectTemplate();
|
||||
|
||||
void Reset();
|
||||
void ReadFromCore(const Core &core);
|
||||
void ReadFromNode(TiXmlElement *node);
|
||||
void SaveToNode(TiXmlElement *node) const;
|
||||
|
||||
bool is_default() const { return is_default_; }
|
||||
void set_is_default(bool is_default) { is_default_ = is_default; }
|
||||
std::string name() const { return name_; }
|
||||
std::string display_name() const;
|
||||
uint32_t options() const { return options_; }
|
||||
std::string vm_section_name() const { return vm_section_name_; }
|
||||
std::string message(size_t idx) const;
|
||||
void set_name(const std::string &name);
|
||||
static std::string default_name() { return "(default)"; }
|
||||
|
||||
virtual void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
bool operator ==(const ProjectTemplate &other) const;
|
||||
bool operator !=(const ProjectTemplate &other) const { return !operator==(other); }
|
||||
private:
|
||||
void Init();
|
||||
ProjectTemplateManager *owner_;
|
||||
bool is_default_;
|
||||
uint32_t options_;
|
||||
std::string name_, vm_section_name_;
|
||||
std::string messages_[MESSAGE_COUNT];
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ProjectTemplate(const ProjectTemplate &);
|
||||
};
|
||||
|
||||
class ProjectTemplateManager : public ObjectList<ProjectTemplate>
|
||||
{
|
||||
public:
|
||||
ProjectTemplateManager(Core *owner);
|
||||
void ReadFromFile(SettingsFile &file);
|
||||
void SaveToFile(SettingsFile &file) const;
|
||||
void Add(const std::string &name, const Core &core);
|
||||
void Notify(MessageType type, IObject *sender, const std::string &message = "") const;
|
||||
void RemoveObject(ProjectTemplate *pt);
|
||||
private:
|
||||
Core *owner_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ProjectTemplateManager(const ProjectTemplateManager &);
|
||||
ProjectTemplateManager &operator =(const ProjectTemplateManager &);
|
||||
};
|
||||
|
||||
class Script;
|
||||
class ILog;
|
||||
class IFile;
|
||||
class IArchitecture;
|
||||
|
||||
class Core : public IObject
|
||||
{
|
||||
public:
|
||||
explicit Core(ILog *log = NULL);
|
||||
virtual ~Core();
|
||||
#ifdef ULTIMATE
|
||||
bool Open(const std::string &file_name, const std::string &user_project_file_name = "", const std::string &user_licensing_params_file_name = "");
|
||||
#else
|
||||
bool Open(const std::string &file_name, const std::string &user_project_file_name = "");
|
||||
#endif
|
||||
bool Save();
|
||||
bool SaveAs(const std::string &file_name);
|
||||
void Close();
|
||||
bool Compile();
|
||||
|
||||
uint32_t options() const { return options_; }
|
||||
std::string vm_section_name() const { return vm_section_name_; }
|
||||
std::string watermark_name() const { return watermark_name_; }
|
||||
IFile *input_file() const { return input_file_; }
|
||||
IFile *output_file() const { return output_file_; }
|
||||
ILog *log() const { return log_; }
|
||||
std::string input_file_name() const { return input_file_name_; }
|
||||
std::string output_file_name() const { return output_file_name_; }
|
||||
void set_options(uint32_t options);
|
||||
void include_option(ProjectOption option);
|
||||
void exclude_option(ProjectOption option);
|
||||
void set_vm_section_name(const std::string &vm_section_name);
|
||||
void set_watermark_name(const std::string &watermark_name);
|
||||
void set_output_file_name(const std::string &output_file_name);
|
||||
std::string message(size_t type) const { return messages_[type]; }
|
||||
void set_message(size_t type, const std::string &message);
|
||||
#ifdef ULTIMATE
|
||||
std::string hwid() const { return hwid_; }
|
||||
void set_hwid(const std::string &hwid);
|
||||
LicensingManager *licensing_manager() const { return licensing_manager_; }
|
||||
FileManager *file_manager() const { return file_manager_; }
|
||||
std::string license_data_file_name() const { return license_data_file_name_; }
|
||||
void set_license_data_file_name(const std::string &license_data_file_name);
|
||||
std::string activation_server() const { return licensing_manager_->activation_server(); }
|
||||
void set_activation_server(const std::string &activation_server);
|
||||
std::string default_license_data_file_name() const;
|
||||
#endif
|
||||
std::string project_path() const;
|
||||
void Notify(MessageType type, IObject *sender, const std::string &message = "");
|
||||
std::string absolute_output_file_name() const;
|
||||
std::string project_file_name() const { return project_file_name_; }
|
||||
WatermarkManager *watermark_manager() const { return watermark_manager_; }
|
||||
ProjectTemplateManager *template_manager() const { return template_manager_; }
|
||||
Script *script() const { return script_; }
|
||||
static const char *copyright() { return "Copyright 2003-2021 VMProtect Software"; }
|
||||
static const char *edition() { return "VMProtect " EDITION; }
|
||||
static const char *version();
|
||||
static const char *build();
|
||||
static bool check_license_edition(const VMProtectSerialNumberData &lic);
|
||||
IArchitecture *input_architecture() const;
|
||||
IArchitecture *output_architecture() const { return output_architecture_; }
|
||||
void LoadFromTemplate(const ProjectTemplate &pt);
|
||||
void SaveToTemplate(ProjectTemplate &pt);
|
||||
private:
|
||||
HANDLE BeginCompileTransaction();
|
||||
void EndCompileTransaction(HANDLE locked_file, bool commit);
|
||||
bool LoadFromXML(const char *project_file_name);
|
||||
bool LoadFromIni(const char *project_file_name);
|
||||
void LoadDefaultFunctions();
|
||||
std::string default_output_file_name() const;
|
||||
|
||||
std::string project_file_name_;
|
||||
bool modified_;
|
||||
IFile *input_file_;
|
||||
std::string input_file_name_;
|
||||
uint32_t options_;
|
||||
uint32_t vm_options_;
|
||||
std::string vm_section_name_;
|
||||
ProjectTemplateManager *template_manager_;
|
||||
std::string output_file_name_;
|
||||
std::string watermark_name_;
|
||||
std::string messages_[MESSAGE_COUNT];
|
||||
IFile *output_file_;
|
||||
ILog *log_;
|
||||
Watermark *watermark_;
|
||||
WatermarkManager *watermark_manager_;
|
||||
Script *script_;
|
||||
IArchitecture *output_architecture_;
|
||||
#ifdef ULTIMATE
|
||||
std::string hwid_;
|
||||
std::string license_data_file_name_;
|
||||
LicensingManager *licensing_manager_;
|
||||
FileManager *file_manager_;
|
||||
#endif
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Core(const Core &);
|
||||
Core &operator =(const Core &);
|
||||
};
|
||||
|
||||
#endif
|
||||
+456
@@ -0,0 +1,456 @@
|
||||
#ifndef DOTNET_H
|
||||
#define DOTNET_H
|
||||
|
||||
typedef LPVOID mdScope; // Why is this still needed?
|
||||
typedef ULONG32 mdToken; // Generic token
|
||||
|
||||
|
||||
// Token definitions
|
||||
|
||||
|
||||
typedef mdToken mdModule; // Module token (roughly, a scope)
|
||||
typedef mdToken mdTypeRef; // TypeRef reference (this or other scope)
|
||||
typedef mdToken mdTypeDef; // TypeDef in this scope
|
||||
typedef mdToken mdFieldDef; // Field in this scope
|
||||
typedef mdToken mdMethodDef; // Method in this scope
|
||||
typedef mdToken mdParamDef; // param token
|
||||
typedef mdToken mdInterfaceImpl; // interface implementation token
|
||||
|
||||
typedef mdToken mdMemberRef; // MemberRef (this or other scope)
|
||||
typedef mdToken mdCustomAttribute; // attribute token
|
||||
typedef mdToken mdPermission; // DeclSecurity
|
||||
|
||||
typedef mdToken mdSignature; // Signature object
|
||||
typedef mdToken mdEvent; // event token
|
||||
typedef mdToken mdProperty; // property token
|
||||
|
||||
typedef mdToken mdModuleRef; // Module reference (for the imported modules)
|
||||
|
||||
// Assembly tokens.
|
||||
typedef mdToken mdAssembly; // Assembly token.
|
||||
typedef mdToken mdAssemblyRef; // AssemblyRef token.
|
||||
typedef mdToken mdFile; // File token.
|
||||
typedef mdToken mdExportedType; // ExportedType token.
|
||||
typedef mdToken mdManifestResource; // ManifestResource token.
|
||||
|
||||
#ifndef __IMAGE_COR20_HEADER_DEFINED__
|
||||
|
||||
typedef enum ReplacesCorHdrNumericDefines
|
||||
{
|
||||
// COM+ Header entry point flags.
|
||||
COMIMAGE_FLAGS_ILONLY =0x00000001,
|
||||
COMIMAGE_FLAGS_32BITREQUIRED =0x00000002,
|
||||
COMIMAGE_FLAGS_IL_LIBRARY =0x00000004,
|
||||
COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,
|
||||
COMIMAGE_FLAGS_NATIVE_ENTRYPOINT =0x00000010,
|
||||
COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,
|
||||
|
||||
// Version flags for image.
|
||||
COR_VERSION_MAJOR_V2 =2,
|
||||
COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,
|
||||
COR_VERSION_MINOR =0,
|
||||
COR_DELETED_NAME_LENGTH =8,
|
||||
COR_VTABLEGAP_NAME_LENGTH =8,
|
||||
|
||||
// Maximum size of a NativeType descriptor.
|
||||
NATIVE_TYPE_MAX_CB =1,
|
||||
COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,
|
||||
|
||||
// #defines for the MIH FLAGS
|
||||
IMAGE_COR_MIH_METHODRVA =0x01,
|
||||
IMAGE_COR_MIH_EHRVA =0x02,
|
||||
IMAGE_COR_MIH_BASICBLOCK =0x08,
|
||||
|
||||
// V-table constants
|
||||
COR_VTABLE_32BIT =0x01, // V-table slots are 32-bits in size.
|
||||
COR_VTABLE_64BIT =0x02, // V-table slots are 64-bits in size.
|
||||
COR_VTABLE_FROM_UNMANAGED =0x04, // If set, transition from unmanaged.
|
||||
COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN =0x08, // If set, transition from unmanaged with keeping the current appdomain.
|
||||
COR_VTABLE_CALL_MOST_DERIVED =0x10, // Call most derived method described by
|
||||
|
||||
// EATJ constants
|
||||
IMAGE_COR_EATJ_THUNK_SIZE =32, // Size of a jump thunk reserved range.
|
||||
|
||||
// Max name lengths
|
||||
//@todo: Change to unlimited name lengths.
|
||||
MAX_CLASS_NAME =1024,
|
||||
MAX_PACKAGE_NAME =1024,
|
||||
} ReplacesCorHdrNumericDefines;
|
||||
|
||||
typedef struct IMAGE_COR20_HEADER
|
||||
{
|
||||
// Header versioning
|
||||
DWORD cb;
|
||||
WORD MajorRuntimeVersion;
|
||||
WORD MinorRuntimeVersion;
|
||||
|
||||
// Symbol table and startup information
|
||||
IMAGE_DATA_DIRECTORY MetaData;
|
||||
DWORD Flags;
|
||||
|
||||
// If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is not set, EntryPointToken represents a managed entrypoint.
|
||||
// If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is set, EntryPointRVA represents an RVA to a native entrypoint.
|
||||
union {
|
||||
DWORD EntryPointToken;
|
||||
DWORD EntryPointRVA;
|
||||
} DUMMYUNIONNAME;
|
||||
|
||||
// Binding information
|
||||
IMAGE_DATA_DIRECTORY Resources;
|
||||
IMAGE_DATA_DIRECTORY StrongNameSignature;
|
||||
|
||||
// Regular fixup and binding information
|
||||
IMAGE_DATA_DIRECTORY CodeManagerTable;
|
||||
IMAGE_DATA_DIRECTORY VTableFixups;
|
||||
IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
|
||||
|
||||
// Precompiled image info (internal use only - set to zero)
|
||||
IMAGE_DATA_DIRECTORY ManagedNativeHeader;
|
||||
|
||||
} IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
|
||||
#endif
|
||||
|
||||
// TypeDef/ExportedType attr bits, used by DefineTypeDef.
|
||||
typedef enum CorTypeAttr
|
||||
{
|
||||
// Use this mask to retrieve the type visibility information.
|
||||
tdVisibilityMask = 0x00000007,
|
||||
tdNotPublic = 0x00000000, // Class is not public scope.
|
||||
tdPublic = 0x00000001, // Class is public scope.
|
||||
tdNestedPublic = 0x00000002, // Class is nested with public visibility.
|
||||
tdNestedPrivate = 0x00000003, // Class is nested with private visibility.
|
||||
tdNestedFamily = 0x00000004, // Class is nested with family visibility.
|
||||
tdNestedAssembly = 0x00000005, // Class is nested with assembly visibility.
|
||||
tdNestedFamANDAssem = 0x00000006, // Class is nested with family and assembly visibility.
|
||||
tdNestedFamORAssem = 0x00000007, // Class is nested with family or assembly visibility.
|
||||
|
||||
// Use this mask to retrieve class layout information
|
||||
tdLayoutMask = 0x00000018,
|
||||
tdAutoLayout = 0x00000000, // Class fields are auto-laid out
|
||||
tdSequentialLayout = 0x00000008, // Class fields are laid out sequentially
|
||||
tdExplicitLayout = 0x00000010, // Layout is supplied explicitly
|
||||
// end layout mask
|
||||
|
||||
// Use this mask to retrieve class semantics information.
|
||||
tdClassSemanticsMask = 0x00000020,
|
||||
tdClass = 0x00000000, // Type is a class.
|
||||
tdInterface = 0x00000020, // Type is an interface.
|
||||
// end semantics mask
|
||||
|
||||
// Special semantics in addition to class semantics.
|
||||
tdAbstract = 0x00000080, // Class is abstract
|
||||
tdSealed = 0x00000100, // Class is concrete and may not be extended
|
||||
tdSpecialName = 0x00000400, // Class name is special. Name describes how.
|
||||
|
||||
// Implementation attributes.
|
||||
tdImport = 0x00001000, // Class / interface is imported
|
||||
tdSerializable = 0x00002000, // The class is Serializable.
|
||||
|
||||
// Use tdStringFormatMask to retrieve string information for native interop
|
||||
tdStringFormatMask = 0x00030000,
|
||||
tdAnsiClass = 0x00000000, // LPTSTR is interpreted as ANSI in this class
|
||||
tdUnicodeClass = 0x00010000, // LPTSTR is interpreted as UNICODE
|
||||
tdAutoClass = 0x00020000, // LPTSTR is interpreted automatically
|
||||
// end string format mask
|
||||
|
||||
tdBeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access.
|
||||
|
||||
// Flags reserved for runtime use.
|
||||
tdReservedMask = 0x00040800,
|
||||
tdRTSpecialName = 0x00000800, // Runtime should check name encoding.
|
||||
tdHasSecurity = 0x00040000, // Class has security associate with it.
|
||||
} CorTypeAttr;
|
||||
|
||||
typedef enum CorILMethodFlags
|
||||
{
|
||||
CorILMethod_InitLocals = 0x0010, // call default constructor on all local vars
|
||||
CorILMethod_MoreSects = 0x0008, // there is another attribute after this one
|
||||
|
||||
CorILMethod_CompressedIL = 0x0040, // FIX Remove this and do it on a per Module basis
|
||||
|
||||
// Indicates the format for the COR_ILMETHOD header
|
||||
CorILMethod_FormatShift = 2,
|
||||
CorILMethod_FormatMask = ((1 << CorILMethod_FormatShift) - 1),
|
||||
CorILMethod_TinyFormat = 0x0002,
|
||||
CorILMethod_SmallFormat = 0x0000,
|
||||
CorILMethod_FatFormat = 0x0003,
|
||||
} CorILMethodFlags;
|
||||
|
||||
typedef struct IMAGE_COR_ILMETHOD_FAT
|
||||
{
|
||||
unsigned Flags : 12; // Flags
|
||||
unsigned Size : 4; // size in DWords of this structure (currently 3)
|
||||
unsigned MaxStack : 16; // maximum number of items (I4, I, I8, obj ...), on the operand stack
|
||||
DWORD CodeSize; // size of the code
|
||||
mdSignature LocalVarSigTok; // token that indicates the signature of the local vars (0 means none)
|
||||
} IMAGE_COR_ILMETHOD_FAT;
|
||||
|
||||
typedef enum CorILMethodSect // codes that identify attributes
|
||||
{
|
||||
CorILMethod_Sect_Reserved = 0,
|
||||
CorILMethod_Sect_EHTable = 1,
|
||||
CorILMethod_Sect_OptILTable = 2,
|
||||
|
||||
CorILMethod_Sect_KindMask = 0x3F, // The mask for decoding the type code
|
||||
CorILMethod_Sect_FatFormat = 0x40, // fat format
|
||||
CorILMethod_Sect_MoreSects = 0x80, // there is another attribute after this one
|
||||
} CorILMethodSect;
|
||||
|
||||
typedef enum CorExceptionFlag
|
||||
{
|
||||
COR_ILEXCEPTION_CLAUSE_NONE,
|
||||
COR_ILEXCEPTION_CLAUSE_FILTER = 0x0001,
|
||||
COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002,
|
||||
COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004,
|
||||
} CorExceptionFlag;
|
||||
|
||||
// MethodDef attr bits, Used by DefineMethod.
|
||||
typedef enum CorMethodAttr
|
||||
{
|
||||
// member access mask - Use this mask to retrieve accessibility information.
|
||||
mdMemberAccessMask = 0x0007,
|
||||
mdPrivateScope = 0x0000, // Member not referenceable.
|
||||
mdPrivate = 0x0001, // Accessible only by the parent type.
|
||||
mdFamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly.
|
||||
mdAssem = 0x0003, // Accessibly by anyone in the Assembly.
|
||||
mdFamily = 0x0004, // Accessible only by type and sub-types.
|
||||
mdFamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly.
|
||||
mdPublic = 0x0006, // Accessibly by anyone who has visibility to this scope.
|
||||
// end member access mask
|
||||
|
||||
// method contract attributes.
|
||||
mdStatic = 0x0010, // Defined on type, else per instance.
|
||||
mdFinal = 0x0020, // Method may not be overridden.
|
||||
mdVirtual = 0x0040, // Method virtual.
|
||||
mdHideBySig = 0x0080, // Method hides by name+sig, else just by name.
|
||||
|
||||
// vtable layout mask - Use this mask to retrieve vtable attributes.
|
||||
mdVtableLayoutMask = 0x0100,
|
||||
mdReuseSlot = 0x0000, // The default.
|
||||
mdNewSlot = 0x0100, // Method always gets a new slot in the vtable.
|
||||
// end vtable layout mask
|
||||
|
||||
// method implementation attributes.
|
||||
mdCheckAccessOnOverride = 0x0200, // Overridability is the same as the visibility.
|
||||
mdAbstract = 0x0400, // Method does not provide an implementation.
|
||||
mdSpecialName = 0x0800, // Method is special. Name describes how.
|
||||
|
||||
// interop attributes
|
||||
mdPinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
|
||||
mdUnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code.
|
||||
|
||||
// Reserved flags for runtime use only.
|
||||
mdReservedMask = 0xd000,
|
||||
mdRTSpecialName = 0x1000, // Runtime should check name encoding.
|
||||
mdHasSecurity = 0x4000, // Method has security associate with it.
|
||||
mdRequireSecObject = 0x8000, // Method calls another method containing security code.
|
||||
|
||||
} CorMethodAttr;
|
||||
|
||||
// Assembly attr bits, used by DefineAssembly.
|
||||
typedef enum CorAssemblyFlags
|
||||
{
|
||||
afPublicKey = 0x0001, // The assembly ref holds the full (unhashed) public key.
|
||||
|
||||
afPA_None = 0x0000, // Processor Architecture unspecified
|
||||
afPA_MSIL = 0x0010, // Processor Architecture: neutral (PE32)
|
||||
afPA_x86 = 0x0020, // Processor Architecture: x86 (PE32)
|
||||
afPA_IA64 = 0x0030, // Processor Architecture: Itanium (PE32+)
|
||||
afPA_AMD64 = 0x0040, // Processor Architecture: AMD X64 (PE32+)
|
||||
afPA_ARM = 0x0050, // Processor Architecture: ARM (PE32)
|
||||
afPA_ARM64 = 0x0060, // Processor Architecture: ARM64 (PE32+)
|
||||
afPA_NoPlatform = 0x0070, // applies to any platform but cannot run on any (e.g. reference assembly), should not have "specified" set
|
||||
afPA_Specified = 0x0080, // Propagate PA flags to AssemblyRef record
|
||||
afPA_Mask = 0x0070, // Bits describing the processor architecture
|
||||
afPA_FullMask = 0x00F0, // Bits describing the PA incl. Specified
|
||||
afPA_Shift = 0x0004, // NOT A FLAG, shift count in PA flags <--> index conversion
|
||||
|
||||
afEnableJITcompileTracking = 0x8000, // From "DebuggableAttribute".
|
||||
afDisableJITcompileOptimizer = 0x4000, // From "DebuggableAttribute".
|
||||
afDebuggableAttributeMask = 0xc000,
|
||||
|
||||
afRetargetable = 0x0100, // The assembly can be retargeted (at runtime) to an
|
||||
// assembly from a different publisher.
|
||||
|
||||
afContentType_Default = 0x0000,
|
||||
afContentType_WindowsRuntime = 0x0200,
|
||||
afContentType_Mask = 0x0E00, // Bits describing ContentType
|
||||
} CorAssemblyFlags;
|
||||
|
||||
// FieldDef attr bits, used by DefineField.
|
||||
typedef enum CorFieldAttr
|
||||
{
|
||||
// member access mask - Use this mask to retrieve accessibility information.
|
||||
fdFieldAccessMask = 0x0007,
|
||||
fdPrivateScope = 0x0000, // Member not referenceable.
|
||||
fdPrivate = 0x0001, // Accessible only by the parent type.
|
||||
fdFamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly.
|
||||
fdAssembly = 0x0003, // Accessibly by anyone in the Assembly.
|
||||
fdFamily = 0x0004, // Accessible only by type and sub-types.
|
||||
fdFamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly.
|
||||
fdPublic = 0x0006, // Accessibly by anyone who has visibility to this scope.
|
||||
// end member access mask
|
||||
|
||||
// field contract attributes.
|
||||
fdStatic = 0x0010, // Defined on type, else per instance.
|
||||
fdInitOnly = 0x0020, // Field may only be initialized, not written to after init.
|
||||
fdLiteral = 0x0040, // Value is compile time constant.
|
||||
fdNotSerialized = 0x0080, // Field does not have to be serialized when type is remoted.
|
||||
|
||||
fdSpecialName = 0x0200, // field is special. Name describes how.
|
||||
|
||||
// interop attributes
|
||||
fdPinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
|
||||
|
||||
// Reserved flags for runtime use only.
|
||||
fdReservedMask = 0x9500,
|
||||
fdRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
|
||||
fdHasFieldMarshal = 0x1000, // Field has marshalling information.
|
||||
fdHasDefault = 0x8000, // Field has default.
|
||||
fdHasFieldRVA = 0x0100, // Field has RVA.
|
||||
} CorFieldAttr;
|
||||
|
||||
// MethodImpl attr bits, used by DefineMethodImpl.
|
||||
typedef enum CorMethodImpl
|
||||
{
|
||||
// code impl mask
|
||||
miCodeTypeMask = 0x0003, // Flags about code type.
|
||||
miIL = 0x0000, // Method impl is IL.
|
||||
miNative = 0x0001, // Method impl is native.
|
||||
miOPTIL = 0x0002, // Method impl is OPTIL
|
||||
miRuntime = 0x0003, // Method impl is provided by the runtime.
|
||||
// end code impl mask
|
||||
|
||||
// managed mask
|
||||
miManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged.
|
||||
miUnmanaged = 0x0004, // Method impl is unmanaged, otherwise managed.
|
||||
miManaged = 0x0000, // Method impl is managed.
|
||||
// end managed mask
|
||||
|
||||
// implementation info and interop
|
||||
miForwardRef = 0x0010, // Indicates method is defined; used primarily in merge scenarios.
|
||||
miPreserveSig = 0x0080, // Indicates method sig is not to be mangled to do HRESULT conversion.
|
||||
|
||||
miInternalCall = 0x1000, // Reserved for internal use.
|
||||
|
||||
miSynchronized = 0x0020, // Method is single threaded through the body.
|
||||
miNoInlining = 0x0008, // Method may not be inlined.
|
||||
miMaxMethodImplVal = 0xffff, // Range check value
|
||||
} CorMethodImpl;
|
||||
|
||||
typedef enum CorPropertyAttr
|
||||
{
|
||||
prSpecialName = 0x0200, // property is special. Name describes how.
|
||||
|
||||
// Reserved flags for Runtime use only.
|
||||
prReservedMask = 0xf400,
|
||||
prRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
|
||||
prHasDefault = 0x1000, // Property has default
|
||||
|
||||
prUnused = 0xe9ff,
|
||||
} CorPropertyAttr;
|
||||
|
||||
// Event attr bits, used by DefineEvent.
|
||||
typedef enum CorEventAttr
|
||||
{
|
||||
evSpecialName = 0x0200, // event is special. Name describes how.
|
||||
|
||||
// Reserved flags for Runtime use only.
|
||||
evReservedMask = 0x0400,
|
||||
evRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
|
||||
} CorEventAttr;
|
||||
|
||||
// ManifestResource attr bits, used by DefineManifestResource.
|
||||
typedef enum CorManifestResourceFlags
|
||||
{
|
||||
mrVisibilityMask = 0x0007,
|
||||
mrPublic = 0x0001, // The Resource is exported from the Assembly.
|
||||
mrPrivate = 0x0002, // The Resource is private to the Assembly.
|
||||
} CorManifestResourceFlags;
|
||||
|
||||
typedef enum CorMethodSemanticsAttr
|
||||
{
|
||||
msSetter = 0x0001,
|
||||
msGetter = 0x0002,
|
||||
msOther = 0x0004,
|
||||
msAddOn = 0x0008,
|
||||
msRemoveOn = 0x0010,
|
||||
msFire = 0x0020,
|
||||
} CorMethodSemanticsAttr;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Element type for Cor signature
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
typedef enum CorElementType
|
||||
{
|
||||
ELEMENT_TYPE_END = 0x0,
|
||||
ELEMENT_TYPE_VOID = 0x1,
|
||||
ELEMENT_TYPE_BOOLEAN = 0x2,
|
||||
ELEMENT_TYPE_CHAR = 0x3,
|
||||
ELEMENT_TYPE_I1 = 0x4,
|
||||
ELEMENT_TYPE_U1 = 0x5,
|
||||
ELEMENT_TYPE_I2 = 0x6,
|
||||
ELEMENT_TYPE_U2 = 0x7,
|
||||
ELEMENT_TYPE_I4 = 0x8,
|
||||
ELEMENT_TYPE_U4 = 0x9,
|
||||
ELEMENT_TYPE_I8 = 0xa,
|
||||
ELEMENT_TYPE_U8 = 0xb,
|
||||
ELEMENT_TYPE_R4 = 0xc,
|
||||
ELEMENT_TYPE_R8 = 0xd,
|
||||
ELEMENT_TYPE_STRING = 0xe,
|
||||
|
||||
// every type above PTR will be simple type
|
||||
ELEMENT_TYPE_PTR = 0xf, // PTR <type>
|
||||
ELEMENT_TYPE_BYREF = 0x10, // BYREF <type>
|
||||
|
||||
// Please use ELEMENT_TYPE_VALUETYPE. ELEMENT_TYPE_VALUECLASS is deprecated.
|
||||
ELEMENT_TYPE_VALUETYPE = 0x11, // VALUETYPE <class Token>
|
||||
ELEMENT_TYPE_CLASS = 0x12, // CLASS <class Token>
|
||||
ELEMENT_TYPE_VAR = 0x13, // number
|
||||
|
||||
ELEMENT_TYPE_ARRAY = 0x14, // MDARRAY <type> <rank> <bcount> <bound1> ... <lbcount> <lb1> ...
|
||||
ELEMENT_TYPE_GENERICINST = 0x15, // <type> <type-arg-count> <type-1> \x{2026} <type-n>
|
||||
|
||||
ELEMENT_TYPE_TYPEDBYREF = 0x16, // This is a simple type.
|
||||
|
||||
ELEMENT_TYPE_I = 0x18, // native integer size
|
||||
ELEMENT_TYPE_U = 0x19, // native unsigned integer size
|
||||
ELEMENT_TYPE_FNPTR = 0x1B, // FNPTR <complete sig for the function including calling convention>
|
||||
ELEMENT_TYPE_OBJECT = 0x1C, // Shortcut for System.Object
|
||||
ELEMENT_TYPE_SZARRAY = 0x1D, // Shortcut for single dimension zero lower bound array
|
||||
// SZARRAY <type>
|
||||
ELEMENT_TYPE_MVAR = 0x1E, // number
|
||||
|
||||
// This is only for binding
|
||||
ELEMENT_TYPE_CMOD_REQD = 0x1F, // required C modifier : E_T_CMOD_REQD <mdTypeRef/mdTypeDef>
|
||||
ELEMENT_TYPE_CMOD_OPT = 0x20, // optional C modifier : E_T_CMOD_OPT <mdTypeRef/mdTypeDef>
|
||||
|
||||
// This is for signatures generated internally (which will not be persisted in any way).
|
||||
ELEMENT_TYPE_INTERNAL = 0x21, // INTERNAL <typehandle>
|
||||
|
||||
// Note that this is the max of base type excluding modifiers
|
||||
ELEMENT_TYPE_MAX = 0x22, // first invalid element type
|
||||
|
||||
|
||||
ELEMENT_TYPE_MODIFIER = 0x40,
|
||||
ELEMENT_TYPE_SENTINEL = 0x01 | ELEMENT_TYPE_MODIFIER, // sentinel for varargs
|
||||
ELEMENT_TYPE_PINNED = 0x05 | ELEMENT_TYPE_MODIFIER,
|
||||
|
||||
// For internal usage only
|
||||
|
||||
ELEMENT_TYPE_TYPE = 0x50,
|
||||
ELEMENT_TYPE_TAGGED_OBJECT = 0x51,
|
||||
ELEMENT_TYPE_ENUM = 0x55
|
||||
} CorElementType;
|
||||
|
||||
typedef struct IMAGE_COR_VTABLEFIXUP
|
||||
{
|
||||
ULONG RVA; // Offset of v-table array in image.
|
||||
USHORT Count; // How many entries at location.
|
||||
USHORT Type; // COR_VTABLE_xxx type of entries.
|
||||
} IMAGE_COR_VTABLEFIXUP;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+12426
File diff suppressed because it is too large
Load Diff
+2841
File diff suppressed because it is too large
Load Diff
+1188
File diff suppressed because it is too large
Load Diff
+121
@@ -0,0 +1,121 @@
|
||||
#ifndef DWARF_H
|
||||
#define DWARF_H
|
||||
|
||||
class CommonInformationEntryList;
|
||||
class IArchitecture;
|
||||
|
||||
class EncodedData : public std::vector<uint8_t>
|
||||
{
|
||||
public:
|
||||
EncodedData(uint64_t address = 0, OperandSize pointer_size = osByte);
|
||||
void ReadFromFile(IArchitecture &file, size_t size);
|
||||
uint8_t ReadByte(size_t *pos) const;
|
||||
uint16_t ReadWord(size_t *pos) const;
|
||||
uint32_t ReadDWord(size_t *pos) const;
|
||||
uint64_t ReadQWord(size_t *pos) const;
|
||||
uint64_t ReadUleb128(size_t *pos) const;
|
||||
int64_t ReadSleb128(size_t *pos) const;
|
||||
std::string ReadString(size_t *pos) const;
|
||||
uint32_t ReadUnsigned(size_t *pos) const;
|
||||
uint64_t ReadEncoding(uint8_t encoding, size_t *pos) const;
|
||||
void WriteString(const std::string &str);
|
||||
void WriteUleb128(uint64_t value);
|
||||
void WriteSleb128(int64_t value);
|
||||
void WriteByte(uint8_t value);
|
||||
void WriteWord(uint16_t value);
|
||||
void WriteDWord(uint32_t value);
|
||||
void WriteQWord(uint64_t value);
|
||||
void WriteEncoding(uint8_t encoding, uint64_t value);
|
||||
uint64_t address() const { return address_; }
|
||||
OperandSize pointer_size() const { return pointer_size_; }
|
||||
void Read(void *buf, size_t count, size_t *pos) const;
|
||||
void Write(const void *buf, size_t count);
|
||||
size_t encoding_size(uint8_t encoding) const;
|
||||
private:
|
||||
uint64_t address_;
|
||||
OperandSize pointer_size_;
|
||||
};
|
||||
|
||||
class CommonInformationEntry : public IObject
|
||||
{
|
||||
public:
|
||||
explicit CommonInformationEntry(CommonInformationEntryList *owner, uint8_t version, const std::string &augmentation,
|
||||
uint64_t code_alignment_factor, uint64_t data_alignment_factor, uint8_t return_adddress_register, uint8_t fde_encoding,
|
||||
uint8_t lsda_encoding, uint8_t personality_encoding, uint64_t personality_routine, const std::vector<uint8_t> &initial_instructions);
|
||||
explicit CommonInformationEntry(CommonInformationEntryList *owner, const CommonInformationEntry &src);
|
||||
~CommonInformationEntry();
|
||||
CommonInformationEntry *Clone(CommonInformationEntryList *owner) const;
|
||||
uint8_t version() const { return version_; }
|
||||
std::string augmentation() const { return augmentation_; }
|
||||
uint64_t code_alignment_factor() const { return code_alignment_factor_; }
|
||||
uint64_t data_alignment_factor() const { return data_alignment_factor_; }
|
||||
uint8_t return_address_register() const { return return_address_register_; }
|
||||
uint8_t fde_encoding() const { return fde_encoding_; }
|
||||
uint8_t lsda_encoding() const { return lsda_encoding_; }
|
||||
uint8_t personality_encoding() const { return personality_encoding_; }
|
||||
uint64_t personality_routine() const { return personality_routine_; }
|
||||
std::vector<uint8_t> initial_instructions() const { return initial_instructions_; }
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
CommonInformationEntryList *owner_;
|
||||
uint8_t version_;
|
||||
std::string augmentation_;
|
||||
uint64_t code_alignment_factor_;
|
||||
uint64_t data_alignment_factor_;
|
||||
uint8_t return_address_register_;
|
||||
uint8_t fde_encoding_;
|
||||
uint8_t lsda_encoding_;
|
||||
uint8_t personality_encoding_;
|
||||
uint64_t personality_routine_;
|
||||
std::vector<uint8_t> initial_instructions_;
|
||||
};
|
||||
|
||||
class CommonInformationEntryList : public ObjectList<CommonInformationEntry>
|
||||
{
|
||||
public:
|
||||
explicit CommonInformationEntryList();
|
||||
explicit CommonInformationEntryList(const CommonInformationEntryList &src);
|
||||
CommonInformationEntry *Add(uint8_t version, const std::string &augmentation, uint64_t code_alignment_factor,
|
||||
uint64_t data_alignment_factor, uint8_t return_address_register, uint8_t fde_encoding,
|
||||
uint8_t lsda_encoding, uint8_t personality_encoding, uint64_t personality_routine, const std::vector<uint8_t> &call_frame_instructions);
|
||||
CommonInformationEntryList *Clone() const;
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
// no assignment op
|
||||
CommonInformationEntryList &operator =(const CommonInformationEntryList &);
|
||||
};
|
||||
|
||||
class DwarfParser
|
||||
{
|
||||
public:
|
||||
static uint32_t CreateCompactEncoding(IArchitecture &file, const std::vector<uint8_t> &fde_instructions, CommonInformationEntry *cie_, uint64_t start);
|
||||
private:
|
||||
enum { kMaxRegisterNumber = 120 };
|
||||
enum RegisterSavedWhere { kRegisterUnused, kRegisterInCFA, kRegisterOffsetFromCFA,
|
||||
kRegisterInRegister, kRegisterAtExpression, kRegisterIsExpression } ;
|
||||
struct RegisterLocation {
|
||||
RegisterSavedWhere location;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
struct PrologInfo {
|
||||
uint32_t cfaRegister;
|
||||
int32_t cfaRegisterOffset; // CFA = (cfaRegister)+cfaRegisterOffset
|
||||
int64_t cfaExpression; // CFA = expression
|
||||
uint32_t spExtraArgSize;
|
||||
uint32_t codeOffsetAtStackDecrement;
|
||||
uint8_t registerSavedTwiceInCIE;
|
||||
bool registersInOtherRegisters;
|
||||
bool registerSavedMoreThanOnce;
|
||||
bool cfaOffsetWasNegative;
|
||||
bool sameValueUsed;
|
||||
RegisterLocation savedRegisters[kMaxRegisterNumber]; // from where to restore registers
|
||||
};
|
||||
static bool ParseInstructions(const std::vector<uint8_t> &instructions, CommonInformationEntry *cie_, PrologInfo &info);
|
||||
static uint32_t CreateCompactEncodingForX32(IArchitecture &file, uint64_t start, PrologInfo &info);
|
||||
static uint32_t CreateCompactEncodingForX64(IArchitecture &file, uint64_t start, PrologInfo &info);
|
||||
static uint32_t GetRBPEncodedRegister(uint32_t reg, int32_t regOffsetFromBaseOffset, bool &failure);
|
||||
static uint32_t GetEBPEncodedRegister(uint32_t reg, int32_t regOffsetFromBaseOffset, bool &failure);
|
||||
};
|
||||
|
||||
#endif
|
||||
+693
@@ -0,0 +1,693 @@
|
||||
/**
|
||||
* ELF format.
|
||||
*/
|
||||
|
||||
#ifndef ELF_H
|
||||
#define ELF_H
|
||||
|
||||
enum {
|
||||
EI_MAG0 = 0, // File identification index.
|
||||
EI_MAG1 = 1, // File identification index.
|
||||
EI_MAG2 = 2, // File identification index.
|
||||
EI_MAG3 = 3, // File identification index.
|
||||
EI_CLASS = 4, // File class.
|
||||
EI_DATA = 5, // Data encoding.
|
||||
EI_VERSION = 6, // File version.
|
||||
EI_OSABI = 7, // OS/ABI identification.
|
||||
EI_ABIVERSION = 8, // ABI version.
|
||||
EI_PAD = 9, // Start of padding bytes.
|
||||
EI_NIDENT = 16 // Number of bytes in e_ident.
|
||||
};
|
||||
|
||||
struct Elf32_Ehdr {
|
||||
uint8_t e_ident[EI_NIDENT]; // ELF Identification bytes
|
||||
uint16_t e_type; // Type of file (see ET_* below)
|
||||
uint16_t e_machine; // Required architecture for this file (see EM_*)
|
||||
uint32_t e_version; // Must be equal to 1
|
||||
uint32_t e_entry; // Address to jump to in order to start program
|
||||
uint32_t e_phoff; // Program header table's file offset, in bytes
|
||||
uint32_t e_shoff; // Section header table's file offset, in bytes
|
||||
uint32_t e_flags; // Processor-specific flags
|
||||
uint16_t e_ehsize; // Size of ELF header, in bytes
|
||||
uint16_t e_phentsize; // Size of an entry in the program header table
|
||||
uint16_t e_phnum; // Number of entries in the program header table
|
||||
uint16_t e_shentsize; // Size of an entry in the section header table
|
||||
uint16_t e_shnum; // Number of entries in the section header table
|
||||
uint16_t e_shstrndx; // Sect hdr table index of sect name string table
|
||||
};
|
||||
|
||||
struct Elf64_Ehdr {
|
||||
uint8_t e_ident[EI_NIDENT];
|
||||
uint16_t e_type;
|
||||
uint16_t e_machine;
|
||||
uint32_t e_version;
|
||||
uint64_t e_entry;
|
||||
uint64_t e_phoff;
|
||||
uint64_t e_shoff;
|
||||
uint32_t e_flags;
|
||||
uint16_t e_ehsize;
|
||||
uint16_t e_phentsize;
|
||||
uint16_t e_phnum;
|
||||
uint16_t e_shentsize;
|
||||
uint16_t e_shnum;
|
||||
uint16_t e_shstrndx;
|
||||
};
|
||||
|
||||
enum {
|
||||
ELFCLASSNONE = 0,
|
||||
ELFCLASS32 = 1, // 32-bit object file
|
||||
ELFCLASS64 = 2 // 64-bit object file
|
||||
};
|
||||
|
||||
enum {
|
||||
EV_NONE = 0,
|
||||
EV_CURRENT = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
ELFOSABI_NONE = 0, // UNIX System V ABI
|
||||
ELFOSABI_SYSV = 0, // Alias
|
||||
ELFOSABI_HPUX = 1, // HP-UX
|
||||
ELFOSABI_NETBSD = 2, // NetBSD
|
||||
ELFOSABI_GNU = 3, // Object uses GNU ELF extensions
|
||||
ELFOSABI_LINUX = 3, // Compatibility alias
|
||||
ELFOSABI_SOLARIS = 6, // Sun Solaris
|
||||
ELFOSABI_AIX = 7, // IBM AIX
|
||||
ELFOSABI_IRIX = 8, // SGI Irix
|
||||
ELFOSABI_FREEBSD = 9, // FreeBSD
|
||||
ELFOSABI_TRU64 = 10, // Compaq TRU64 UNIX
|
||||
ELFOSABI_MODESTO = 11, // Novell Modesto
|
||||
ELFOSABI_OPENBSD = 12, // OpenBSD
|
||||
ELFOSABI_ARM_AEABI = 64, // ARM EABI
|
||||
ELFOSABI_ARM = 97, // ARM
|
||||
ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
|
||||
};
|
||||
|
||||
enum {
|
||||
ET_NONE = 0, // No file type
|
||||
ET_REL = 1, // Relocatable file
|
||||
ET_EXEC = 2, // Executable file
|
||||
ET_DYN = 3, // Shared object file
|
||||
ET_CORE = 4, // Core file
|
||||
ET_LOPROC = 0xff00, // Beginning of processor-specific codes
|
||||
ET_HIPROC = 0xffff // Processor-specific
|
||||
};
|
||||
|
||||
enum {
|
||||
EM_NONE = 0, // No machine
|
||||
EM_M32 = 1, // AT&T WE 32100
|
||||
EM_SPARC = 2, // SPARC
|
||||
EM_386 = 3, // Intel 386
|
||||
EM_68K = 4, // Motorola 68000
|
||||
EM_88K = 5, // Motorola 88000
|
||||
EM_486 = 6, // Intel 486 (deprecated)
|
||||
EM_860 = 7, // Intel 80860
|
||||
EM_MIPS = 8, // MIPS R3000
|
||||
EM_S370 = 9, // IBM System/370
|
||||
EM_MIPS_RS3_LE = 10, // MIPS RS3000 Little-endian
|
||||
EM_PARISC = 15, // Hewlett-Packard PA-RISC
|
||||
EM_VPP500 = 17, // Fujitsu VPP500
|
||||
EM_SPARC32PLUS = 18, // Enhanced instruction set SPARC
|
||||
EM_960 = 19, // Intel 80960
|
||||
EM_PPC = 20, // PowerPC
|
||||
EM_PPC64 = 21, // PowerPC64
|
||||
EM_S390 = 22, // IBM System/390
|
||||
EM_SPU = 23, // IBM SPU/SPC
|
||||
EM_V800 = 36, // NEC V800
|
||||
EM_FR20 = 37, // Fujitsu FR20
|
||||
EM_RH32 = 38, // TRW RH-32
|
||||
EM_RCE = 39, // Motorola RCE
|
||||
EM_ARM = 40, // ARM
|
||||
EM_ALPHA = 41, // DEC Alpha
|
||||
EM_SH = 42, // Hitachi SH
|
||||
EM_SPARCV9 = 43, // SPARC V9
|
||||
EM_TRICORE = 44, // Siemens TriCore
|
||||
EM_ARC = 45, // Argonaut RISC Core
|
||||
EM_H8_300 = 46, // Hitachi H8/300
|
||||
EM_H8_300H = 47, // Hitachi H8/300H
|
||||
EM_H8S = 48, // Hitachi H8S
|
||||
EM_H8_500 = 49, // Hitachi H8/500
|
||||
EM_IA_64 = 50, // Intel IA-64 processor architecture
|
||||
EM_MIPS_X = 51, // Stanford MIPS-X
|
||||
EM_COLDFIRE = 52, // Motorola ColdFire
|
||||
EM_68HC12 = 53, // Motorola M68HC12
|
||||
EM_MMA = 54, // Fujitsu MMA Multimedia Accelerator
|
||||
EM_PCP = 55, // Siemens PCP
|
||||
EM_NCPU = 56, // Sony nCPU embedded RISC processor
|
||||
EM_NDR1 = 57, // Denso NDR1 microprocessor
|
||||
EM_STARCORE = 58, // Motorola Star*Core processor
|
||||
EM_ME16 = 59, // Toyota ME16 processor
|
||||
EM_ST100 = 60, // STMicroelectronics ST100 processor
|
||||
EM_TINYJ = 61, // Advanced Logic Corp. TinyJ embedded processor family
|
||||
EM_X86_64 = 62, // AMD x86-64 architecture
|
||||
EM_PDSP = 63, // Sony DSP Processor
|
||||
EM_PDP10 = 64, // Digital Equipment Corp. PDP-10
|
||||
EM_PDP11 = 65, // Digital Equipment Corp. PDP-11
|
||||
EM_FX66 = 66, // Siemens FX66 microcontroller
|
||||
EM_ST9PLUS = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller
|
||||
EM_ST7 = 68, // STMicroelectronics ST7 8-bit microcontroller
|
||||
EM_68HC16 = 69, // Motorola MC68HC16 Microcontroller
|
||||
EM_68HC11 = 70, // Motorola MC68HC11 Microcontroller
|
||||
EM_68HC08 = 71, // Motorola MC68HC08 Microcontroller
|
||||
EM_68HC05 = 72, // Motorola MC68HC05 Microcontroller
|
||||
EM_SVX = 73, // Silicon Graphics SVx
|
||||
EM_ST19 = 74, // STMicroelectronics ST19 8-bit microcontroller
|
||||
EM_VAX = 75, // Digital VAX
|
||||
EM_CRIS = 76, // Axis Communications 32-bit embedded processor
|
||||
EM_JAVELIN = 77, // Infineon Technologies 32-bit embedded processor
|
||||
EM_FIREPATH = 78, // Element 14 64-bit DSP Processor
|
||||
EM_ZSP = 79, // LSI Logic 16-bit DSP Processor
|
||||
EM_MMIX = 80, // Donald Knuth's educational 64-bit processor
|
||||
EM_HUANY = 81, // Harvard University machine-independent object files
|
||||
EM_PRISM = 82, // SiTera Prism
|
||||
EM_AVR = 83, // Atmel AVR 8-bit microcontroller
|
||||
EM_FR30 = 84, // Fujitsu FR30
|
||||
EM_D10V = 85, // Mitsubishi D10V
|
||||
EM_D30V = 86, // Mitsubishi D30V
|
||||
EM_V850 = 87, // NEC v850
|
||||
EM_M32R = 88, // Mitsubishi M32R
|
||||
EM_MN10300 = 89, // Matsushita MN10300
|
||||
EM_MN10200 = 90, // Matsushita MN10200
|
||||
EM_PJ = 91, // picoJava
|
||||
EM_OPENRISC = 92, // OpenRISC 32-bit embedded processor
|
||||
EM_ARC_COMPACT = 93, // ARC International ARCompact processor (old
|
||||
// spelling/synonym: EM_ARC_A5)
|
||||
EM_XTENSA = 94, // Tensilica Xtensa Architecture
|
||||
EM_VIDEOCORE = 95, // Alphamosaic VideoCore processor
|
||||
EM_TMM_GPP = 96, // Thompson Multimedia General Purpose Processor
|
||||
EM_NS32K = 97, // National Semiconductor 32000 series
|
||||
EM_TPC = 98, // Tenor Network TPC processor
|
||||
EM_SNP1K = 99, // Trebia SNP 1000 processor
|
||||
EM_ST200 = 100, // STMicroelectronics (www.st.com) ST200
|
||||
EM_IP2K = 101, // Ubicom IP2xxx microcontroller family
|
||||
EM_MAX = 102, // MAX Processor
|
||||
EM_CR = 103, // National Semiconductor CompactRISC microprocessor
|
||||
EM_F2MC16 = 104, // Fujitsu F2MC16
|
||||
EM_MSP430 = 105, // Texas Instruments embedded microcontroller msp430
|
||||
EM_BLACKFIN = 106, // Analog Devices Blackfin (DSP) processor
|
||||
EM_SE_C33 = 107, // S1C33 Family of Seiko Epson processors
|
||||
EM_SEP = 108, // Sharp embedded microprocessor
|
||||
EM_ARCA = 109, // Arca RISC Microprocessor
|
||||
EM_UNICORE = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC
|
||||
// of Peking University
|
||||
EM_EXCESS = 111, // eXcess: 16/32/64-bit configurable embedded CPU
|
||||
EM_DXP = 112, // Icera Semiconductor Inc. Deep Execution Processor
|
||||
EM_ALTERA_NIOS2 = 113, // Altera Nios II soft-core processor
|
||||
EM_CRX = 114, // National Semiconductor CompactRISC CRX
|
||||
EM_XGATE = 115, // Motorola XGATE embedded processor
|
||||
EM_C166 = 116, // Infineon C16x/XC16x processor
|
||||
EM_M16C = 117, // Renesas M16C series microprocessors
|
||||
EM_DSPIC30F = 118, // Microchip Technology dsPIC30F Digital Signal
|
||||
// Controller
|
||||
EM_CE = 119, // Freescale Communication Engine RISC core
|
||||
EM_M32C = 120, // Renesas M32C series microprocessors
|
||||
EM_TSK3000 = 131, // Altium TSK3000 core
|
||||
EM_RS08 = 132, // Freescale RS08 embedded processor
|
||||
EM_SHARC = 133, // Analog Devices SHARC family of 32-bit DSP
|
||||
// processors
|
||||
EM_ECOG2 = 134, // Cyan Technology eCOG2 microprocessor
|
||||
EM_SCORE7 = 135, // Sunplus S+core7 RISC processor
|
||||
EM_DSP24 = 136, // New Japan Radio (NJR) 24-bit DSP Processor
|
||||
EM_VIDEOCORE3 = 137, // Broadcom VideoCore III processor
|
||||
EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture
|
||||
EM_SE_C17 = 139, // Seiko Epson C17 family
|
||||
EM_TI_C6000 = 140, // The Texas Instruments TMS320C6000 DSP family
|
||||
EM_TI_C2000 = 141, // The Texas Instruments TMS320C2000 DSP family
|
||||
EM_TI_C5500 = 142, // The Texas Instruments TMS320C55x DSP family
|
||||
EM_MMDSP_PLUS = 160, // STMicroelectronics 64bit VLIW Data Signal Processor
|
||||
EM_CYPRESS_M8C = 161, // Cypress M8C microprocessor
|
||||
EM_R32C = 162, // Renesas R32C series microprocessors
|
||||
EM_TRIMEDIA = 163, // NXP Semiconductors TriMedia architecture family
|
||||
EM_HEXAGON = 164, // Qualcomm Hexagon processor
|
||||
EM_8051 = 165, // Intel 8051 and variants
|
||||
EM_STXP7X = 166, // STMicroelectronics STxP7x family of configurable
|
||||
// and extensible RISC processors
|
||||
EM_NDS32 = 167, // Andes Technology compact code size embedded RISC
|
||||
// processor family
|
||||
EM_ECOG1 = 168, // Cyan Technology eCOG1X family
|
||||
EM_ECOG1X = 168, // Cyan Technology eCOG1X family
|
||||
EM_MAXQ30 = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers
|
||||
EM_XIMO16 = 170, // New Japan Radio (NJR) 16-bit DSP Processor
|
||||
EM_MANIK = 171, // M2000 Reconfigurable RISC Microprocessor
|
||||
EM_CRAYNV2 = 172, // Cray Inc. NV2 vector architecture
|
||||
EM_RX = 173, // Renesas RX family
|
||||
EM_METAG = 174, // Imagination Technologies META processor
|
||||
// architecture
|
||||
EM_MCST_ELBRUS = 175, // MCST Elbrus general purpose hardware architecture
|
||||
EM_ECOG16 = 176, // Cyan Technology eCOG16 family
|
||||
EM_CR16 = 177, // National Semiconductor CompactRISC CR16 16-bit
|
||||
// microprocessor
|
||||
EM_ETPU = 178, // Freescale Extended Time Processing Unit
|
||||
EM_SLE9X = 179, // Infineon Technologies SLE9X core
|
||||
EM_L10M = 180, // Intel L10M
|
||||
EM_K10M = 181, // Intel K10M
|
||||
EM_AARCH64 = 183, // ARM AArch64
|
||||
EM_AVR32 = 185, // Atmel Corporation 32-bit microprocessor family
|
||||
EM_STM8 = 186, // STMicroeletronics STM8 8-bit microcontroller
|
||||
EM_TILE64 = 187, // Tilera TILE64 multicore architecture family
|
||||
EM_TILEPRO = 188, // Tilera TILEPro multicore architecture family
|
||||
EM_CUDA = 190, // NVIDIA CUDA architecture
|
||||
EM_TILEGX = 191, // Tilera TILE-Gx multicore architecture family
|
||||
EM_CLOUDSHIELD = 192, // CloudShield architecture family
|
||||
EM_COREA_1ST = 193, // KIPO-KAIST Core-A 1st generation processor family
|
||||
EM_COREA_2ND = 194, // KIPO-KAIST Core-A 2nd generation processor family
|
||||
EM_ARC_COMPACT2 = 195, // Synopsys ARCompact V2
|
||||
EM_OPEN8 = 196, // Open8 8-bit RISC soft processor core
|
||||
EM_RL78 = 197, // Renesas RL78 family
|
||||
EM_VIDEOCORE5 = 198, // Broadcom VideoCore V processor
|
||||
EM_78KOR = 199, // Renesas 78KOR family
|
||||
EM_56800EX = 200, // Freescale 56800EX Digital Signal Controller (DSC)
|
||||
EM_BA1 = 201, // Beyond BA1 CPU architecture
|
||||
EM_BA2 = 202, // Beyond BA2 CPU architecture
|
||||
EM_XCORE = 203, // XMOS xCORE processor family
|
||||
EM_MCHP_PIC = 204, // Microchip 8-bit PIC(r) family
|
||||
EM_KM32 = 210, // KM211 KM32 32-bit processor
|
||||
EM_KMX32 = 211, // KM211 KMX32 32-bit processor
|
||||
EM_KMX16 = 212, // KM211 KMX16 16-bit processor
|
||||
EM_KMX8 = 213, // KM211 KMX8 8-bit processor
|
||||
EM_KVARC = 214, // KM211 KVARC processor
|
||||
EM_CDP = 215, // Paneve CDP architecture family
|
||||
EM_COGE = 216, // Cognitive Smart Memory Processor
|
||||
EM_COOL = 217, // iCelero CoolEngine
|
||||
EM_NORC = 218, // Nanoradio Optimized RISC
|
||||
EM_CSR_KALIMBA = 219 // CSR Kalimba architecture family
|
||||
};
|
||||
|
||||
/*
|
||||
typedef uint64_t Elf64_Addr;
|
||||
typedef uint64_t Elf64_Off;
|
||||
typedef uint16_t Elf64_Half;
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef int32_t Elf64_Sword;
|
||||
typedef uint64_t Elf64_Xword;
|
||||
typedef int64_t Elf64_Sxword;
|
||||
typedef int16_t Elf64_Section;
|
||||
*/
|
||||
|
||||
struct Elf32_Phdr {
|
||||
uint32_t p_type; // Type of segment
|
||||
uint32_t p_offset; // File offset where segment is located, in bytes
|
||||
uint32_t p_vaddr; // Virtual address of beginning of segment
|
||||
uint32_t p_paddr; // Physical address of beginning of segment (OS-specific)
|
||||
uint32_t p_filesz; // Num. of bytes in file image of segment (may be zero)
|
||||
uint32_t p_memsz; // Num. of bytes in mem image of segment (may be zero)
|
||||
uint32_t p_flags; // Segment flags
|
||||
uint32_t p_align; // Segment alignment constraint
|
||||
};
|
||||
|
||||
struct Elf64_Phdr {
|
||||
uint32_t p_type; // Type of segment
|
||||
uint32_t p_flags; // Segment flags
|
||||
uint64_t p_offset; // File offset where segment is located, in bytes
|
||||
uint64_t p_vaddr; // Virtual address of beginning of segment
|
||||
uint64_t p_paddr; // Physical addr of beginning of segment (OS-specific)
|
||||
uint64_t p_filesz; // Num. of bytes in file image of segment (may be zero)
|
||||
uint64_t p_memsz; // Num. of bytes in mem image of segment (may be zero)
|
||||
uint64_t p_align; // Segment alignment constraint
|
||||
};
|
||||
|
||||
enum {
|
||||
PT_NULL = 0, // Unused segment.
|
||||
PT_LOAD = 1, // Loadable segment.
|
||||
PT_DYNAMIC = 2, // Dynamic linking information.
|
||||
PT_INTERP = 3, // Interpreter pathname.
|
||||
PT_NOTE = 4, // Auxiliary information.
|
||||
PT_SHLIB = 5, // Reserved.
|
||||
PT_PHDR = 6, // The program header table itself.
|
||||
PT_TLS = 7, // The thread-local storage template.
|
||||
PT_LOOS = 0x60000000, // Lowest operating system-specific pt entry type.
|
||||
PT_HIOS = 0x6fffffff, // Highest operating system-specific pt entry type.
|
||||
PT_LOPROC = 0x70000000, // Lowest processor-specific program hdr entry type.
|
||||
PT_HIPROC = 0x7fffffff, // Highest processor-specific program hdr entry type.
|
||||
|
||||
// x86-64 program header types.
|
||||
// These all contain stack unwind tables.
|
||||
PT_GNU_EH_FRAME = 0x6474e550,
|
||||
PT_SUNW_EH_FRAME = 0x6474e550,
|
||||
PT_SUNW_UNWIND = 0x6464e550,
|
||||
|
||||
PT_GNU_STACK = 0x6474e551, // Indicates stack executability.
|
||||
PT_GNU_RELRO = 0x6474e552, // Read-only after relocation.
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
PF_X = 1, // Execute
|
||||
PF_W = 2, // Write
|
||||
PF_R = 4, // Read
|
||||
};
|
||||
|
||||
#define SHN_UNDEF 0
|
||||
|
||||
struct Elf32_Shdr {
|
||||
uint32_t sh_name; // Section name (index into string table)
|
||||
uint32_t sh_type; // Section type (SHT_*)
|
||||
uint32_t sh_flags; // Section flags (SHF_*)
|
||||
uint32_t sh_addr; // Address where section is to be loaded
|
||||
uint32_t sh_offset; // File offset of section data, in bytes
|
||||
uint32_t sh_size; // Size of section, in bytes
|
||||
uint32_t sh_link; // Section type-specific header table index link
|
||||
uint32_t sh_info; // Section type-specific extra information
|
||||
uint32_t sh_addralign; // Section address alignment
|
||||
uint32_t sh_entsize; // Size of records contained within the section
|
||||
};
|
||||
|
||||
struct Elf64_Shdr {
|
||||
uint32_t sh_name;
|
||||
uint32_t sh_type;
|
||||
uint64_t sh_flags;
|
||||
uint64_t sh_addr;
|
||||
uint64_t sh_offset;
|
||||
uint64_t sh_size;
|
||||
uint32_t sh_link;
|
||||
uint32_t sh_info;
|
||||
uint64_t sh_addralign;
|
||||
uint64_t sh_entsize;
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
SHT_NULL = 0, // No associated section (inactive entry).
|
||||
SHT_PROGBITS = 1, // Program-defined contents.
|
||||
SHT_SYMTAB = 2, // Symbol table.
|
||||
SHT_STRTAB = 3, // String table.
|
||||
SHT_RELA = 4, // Relocation entries; explicit addends.
|
||||
SHT_HASH = 5, // Symbol hash table.
|
||||
SHT_DYNAMIC = 6, // Information for dynamic linking.
|
||||
SHT_NOTE = 7, // Information about the file.
|
||||
SHT_NOBITS = 8, // Data occupies no space in the file.
|
||||
SHT_REL = 9, // Relocation entries; no explicit addends.
|
||||
SHT_SHLIB = 10, // Reserved.
|
||||
SHT_DYNSYM = 11, // Symbol table.
|
||||
SHT_INIT_ARRAY = 14, // Pointers to initialization functions.
|
||||
SHT_FINI_ARRAY = 15, // Pointers to termination functions.
|
||||
SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions.
|
||||
SHT_GROUP = 17, // Section group.
|
||||
SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
|
||||
SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
|
||||
SHT_GNU_ATTRIBUTES= 0x6ffffff5, // Object attributes.
|
||||
SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
|
||||
SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions.
|
||||
SHT_GNU_verneed = 0x6ffffffe, // GNU version references.
|
||||
SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table.
|
||||
SHT_HIOS = 0x6fffffff, // Highest operating system-specific type.
|
||||
SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type.
|
||||
SHT_ARM_EXIDX = 0x70000001U, // Exception Index table
|
||||
SHT_ARM_PREEMPTMAP = 0x70000002U, // BPABI DLL dynamic linking pre-emption map
|
||||
SHT_ARM_ATTRIBUTES = 0x70000003U, // Object file compatibility attributes
|
||||
SHT_ARM_DEBUGOVERLAY = 0x70000004U,
|
||||
SHT_ARM_OVERLAYSECTION = 0x70000005U,
|
||||
SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in this section based on their sizes
|
||||
SHT_X86_64_UNWIND = 0x70000001, // Unwind information
|
||||
SHT_MIPS_REGINFO = 0x70000006, // Register usage information
|
||||
SHT_MIPS_OPTIONS = 0x7000000d, // General options
|
||||
SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information.
|
||||
SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
|
||||
SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
|
||||
SHT_HIUSER = 0xffffffff // Highest type reserved for applications.
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
SHF_WRITE = 0x1, // Section data should be writable during execution.
|
||||
SHF_ALLOC = 0x2, // Section occupies memory during program execution.
|
||||
SHF_EXECINSTR = 0x4, // Section contains executable machine instructions.
|
||||
SHF_MERGE = 0x10, // The data in this section may be merged.
|
||||
SHF_STRINGS = 0x20, // The data in this section is null-terminated strings.
|
||||
SHF_INFO_LINK = 0x40U, // A field in this section holds a section header table index.
|
||||
SHF_LINK_ORDER = 0x80U, // Adds special ordering requirements for link editors.
|
||||
SHF_OS_NONCONFORMING = 0x100U, // This section requires special OS-specific processing to avoid incorrect behavior.
|
||||
SHF_GROUP = 0x200U, // This section is a member of a section group.
|
||||
SHF_TLS = 0x400U, // This section holds Thread-Local Storage.
|
||||
SHF_EXCLUDE = 0x80000000U, // This section is excluded from the final executable or shared library.
|
||||
SHF_MASKOS = 0x0ff00000,
|
||||
SHF_MASKPROC = 0xf0000000,
|
||||
SHF_X86_64_LARGE = 0x10000000,
|
||||
SHF_HEX_GPREL = 0x10000000,
|
||||
SHF_MIPS_NODUPES = 0x01000000,
|
||||
SHF_MIPS_NAMES = 0x02000000,
|
||||
SHF_MIPS_LOCAL = 0x04000000, // Section data local to process.
|
||||
SHF_MIPS_NOSTRIP = 0x08000000, // Do not strip this section.
|
||||
SHF_MIPS_GPREL = 0x10000000, // Section must be part of global data area.
|
||||
SHF_MIPS_MERGE = 0x20000000, // This section should be merged.
|
||||
SHF_MIPS_ADDR = 0x40000000, // Address size to be inferred from section entry size.
|
||||
SHF_MIPS_STRING = 0x80000000 // Section data is string data by default.
|
||||
};
|
||||
|
||||
struct Elf32_Sym {
|
||||
uint32_t st_name; // Symbol name (index into string table)
|
||||
uint32_t st_value; // Value or address associated with the symbol
|
||||
uint32_t st_size; // Size of the symbol
|
||||
uint8_t st_info; // Symbol's type and binding attributes
|
||||
uint8_t st_other; // Must be zero; reserved
|
||||
uint16_t st_shndx; // Which section (header table index) it's defined in
|
||||
};
|
||||
|
||||
struct Elf64_Sym {
|
||||
uint32_t st_name; // Symbol name (index into string table)
|
||||
uint8_t st_info; // Symbol's type and binding attributes
|
||||
uint8_t st_other; // Must be zero; reserved
|
||||
uint16_t st_shndx; // Which section (header tbl index) it's defined in
|
||||
uint64_t st_value; // Value or address associated with the symbol
|
||||
uint64_t st_size; // Size of the symbol
|
||||
};
|
||||
|
||||
enum {
|
||||
STT_NOTYPE = 0, // Symbol's type is not specified
|
||||
STT_OBJECT = 1, // Symbol is a data object (variable, array, etc.)
|
||||
STT_FUNC = 2, // Symbol is executable code (function, etc.)
|
||||
STT_SECTION = 3, // Symbol refers to a section
|
||||
STT_FILE = 4, // Local, absolute symbol that refers to a file
|
||||
STT_COMMON = 5, // An uninitialized common block
|
||||
STT_TLS = 6, // Thread local data object
|
||||
STT_LOOS = 7, // Lowest operating system-specific symbol type
|
||||
STT_HIOS = 8, // Highest operating system-specific symbol type
|
||||
STT_GNU_IFUNC = 10, // GNU indirect function
|
||||
STT_LOPROC = 13, // Lowest processor-specific symbol type
|
||||
STT_HIPROC = 15 // Highest processor-specific symbol type
|
||||
};
|
||||
|
||||
enum {
|
||||
STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
|
||||
STB_GLOBAL = 1, // Global symbol, visible to all object files being combined
|
||||
STB_WEAK = 2, // Weak symbol, like global but lower-precedence
|
||||
STB_GNU_UNIQUE = 10,
|
||||
STB_LOOS = 10, // Lowest operating system-specific binding type
|
||||
STB_HIOS = 12, // Highest operating system-specific binding type
|
||||
STB_LOPROC = 13, // Lowest processor-specific binding type
|
||||
STB_HIPROC = 15 // Highest processor-specific binding type
|
||||
};
|
||||
|
||||
struct Elf32_Rel {
|
||||
uint32_t r_offset; // Location (file byte offset, or program virtual addr)
|
||||
uint32_t r_info; // Symbol table index and type of relocation to apply
|
||||
};
|
||||
|
||||
struct Elf64_Rel {
|
||||
uint64_t r_offset; // Location (file byte offset, or program virtual addr)
|
||||
uint32_t r_type; // Type of relocation to apply
|
||||
uint32_t r_ssym; // Symbol table index
|
||||
};
|
||||
|
||||
struct Elf32_Rela {
|
||||
uint32_t r_offset; // Location (file byte offset, or program virtual addr)
|
||||
uint32_t r_info; // Symbol table index and type of relocation to apply
|
||||
uint32_t r_addend;
|
||||
};
|
||||
|
||||
struct Elf64_Rela {
|
||||
uint64_t r_offset; // Location (file byte offset, or program virtual addr)
|
||||
uint32_t r_type; // Type of relocation to apply
|
||||
uint32_t r_ssym; // Symbol table index
|
||||
uint64_t r_addend;
|
||||
};
|
||||
|
||||
struct Elf32_Dyn {
|
||||
uint32_t d_tag; // Type of dynamic table entry.
|
||||
union
|
||||
{
|
||||
uint32_t d_val; // Integer value of entry.
|
||||
uint32_t d_ptr; // Pointer value of entry.
|
||||
} d_un;
|
||||
};
|
||||
|
||||
struct Elf64_Dyn {
|
||||
uint64_t d_tag; // Type of dynamic table entry.
|
||||
union
|
||||
{
|
||||
uint64_t d_val; // Integer value of entry.
|
||||
uint64_t d_ptr; // Pointer value of entry.
|
||||
} d_un;
|
||||
};
|
||||
|
||||
enum {
|
||||
DT_NULL = 0, // Marks end of dynamic array.
|
||||
DT_NEEDED = 1, // String table offset of needed library.
|
||||
DT_PLTRELSZ = 2, // Size of relocation entries in PLT.
|
||||
DT_PLTGOT = 3, // Address associated with linkage table.
|
||||
DT_HASH = 4, // Address of symbolic hash table.
|
||||
DT_STRTAB = 5, // Address of dynamic string table.
|
||||
DT_SYMTAB = 6, // Address of dynamic symbol table.
|
||||
DT_RELA = 7, // Address of relocation table (Rela entries).
|
||||
DT_RELASZ = 8, // Size of Rela relocation table.
|
||||
DT_RELAENT = 9, // Size of a Rela relocation entry.
|
||||
DT_STRSZ = 10, // Total size of the string table.
|
||||
DT_SYMENT = 11, // Size of a symbol table entry.
|
||||
DT_INIT = 12, // Address of initialization function.
|
||||
DT_FINI = 13, // Address of termination function.
|
||||
DT_SONAME = 14, // String table offset of a shared objects name.
|
||||
DT_RPATH = 15, // String table offset of library search path.
|
||||
DT_SYMBOLIC = 16, // Changes symbol resolution algorithm.
|
||||
DT_REL = 17, // Address of relocation table (Rel entries).
|
||||
DT_RELSZ = 18, // Size of Rel relocation table.
|
||||
DT_RELENT = 19, // Size of a Rel relocation entry.
|
||||
DT_PLTREL = 20, // Type of relocation entry used for linking.
|
||||
DT_DEBUG = 21, // Reserved for debugger.
|
||||
DT_TEXTREL = 22, // Relocations exist for non-writable segments.
|
||||
DT_JMPREL = 23, // Address of relocations associated with PLT.
|
||||
DT_BIND_NOW = 24, // Process all relocations before execution.
|
||||
DT_INIT_ARRAY = 25, // Pointer to array of initialization functions.
|
||||
DT_FINI_ARRAY = 26, // Pointer to array of termination functions.
|
||||
DT_INIT_ARRAYSZ = 27, // Size of DT_INIT_ARRAY.
|
||||
DT_FINI_ARRAYSZ = 28, // Size of DT_FINI_ARRAY.
|
||||
DT_RUNPATH = 29, // String table offset of lib search path.
|
||||
DT_FLAGS = 30, // Flags.
|
||||
DT_ENCODING = 32, // Values from here to DT_LOOS follow the rules for the interpretation of the d_un union.
|
||||
DT_PREINIT_ARRAY = 32, // Pointer to array of preinit functions.
|
||||
DT_PREINIT_ARRAYSZ = 33, // Size of the DT_PREINIT_ARRAY array.
|
||||
|
||||
DT_LOOS = 0x60000000, // Start of environment specific tags.
|
||||
DT_HIOS = 0x6FFFFFFF, // End of environment specific tags.
|
||||
DT_LOPROC = 0x70000000, // Start of processor specific tags.
|
||||
DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags.
|
||||
DT_GNU_HASH = 0x6FFFFEF5, // Reference to the GNU hash table.
|
||||
DT_RELACOUNT = 0x6FFFFFF9, // ELF32_Rela count.
|
||||
DT_RELCOUNT = 0x6FFFFFFA, // ELF32_Rel count.
|
||||
DT_FLAGS_1 = 0X6FFFFFFB, // Flags_1.
|
||||
DT_VERSYM = 0x6FFFFFF0, // The address of .gnu.version section.
|
||||
DT_VERDEF = 0X6FFFFFFC, // The address of the version definition table.
|
||||
DT_VERDEFNUM = 0X6FFFFFFD, // The number of entries in DT_VERDEF.
|
||||
DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table.
|
||||
DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
|
||||
};
|
||||
|
||||
/* Version definition sections. */
|
||||
|
||||
struct Elf32_Verdef
|
||||
{
|
||||
uint16_t vd_version; /* Version revision */
|
||||
uint16_t vd_flags; /* Version information */
|
||||
uint16_t vd_ndx; /* Version Index */
|
||||
uint16_t vd_cnt; /* Number of associated aux entries */
|
||||
uint32_t vd_hash; /* Version name hash value */
|
||||
uint32_t vd_aux; /* Offset in bytes to verdaux array */
|
||||
uint32_t vd_next; /* Offset in bytes to next verdef entry */
|
||||
};
|
||||
|
||||
struct Elf64_Verdef
|
||||
{
|
||||
uint16_t vd_version; /* Version revision */
|
||||
uint16_t vd_flags; /* Version information */
|
||||
uint16_t vd_ndx; /* Version Index */
|
||||
uint16_t vd_cnt; /* Number of associated aux entries */
|
||||
uint32_t vd_hash; /* Version name hash value */
|
||||
uint32_t vd_aux; /* Offset in bytes to verdaux array */
|
||||
uint32_t vd_next; /* Offset in bytes to next verdef entry */
|
||||
};
|
||||
|
||||
/* Legal values for vd_version (version revision). */
|
||||
#define VER_DEF_NONE 0 /* No version */
|
||||
#define VER_DEF_CURRENT 1 /* Current version */
|
||||
#define VER_DEF_NUM 2 /* Given version number */
|
||||
|
||||
/* Legal values for vd_flags (version information flags). */
|
||||
#define VER_FLG_BASE 0x1 /* Version definition of file itself */
|
||||
#define VER_FLG_WEAK 0x2 /* Weak version identifier */
|
||||
|
||||
/* Versym symbol index values. */
|
||||
#define VER_NDX_LOCAL 0 /* Symbol is local. */
|
||||
#define VER_NDX_GLOBAL 1 /* Symbol is global. */
|
||||
#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
|
||||
#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
|
||||
|
||||
/* Auxialiary version information. */
|
||||
|
||||
struct Elf32_Verdaux
|
||||
{
|
||||
uint32_t vda_name; /* Version or dependency names */
|
||||
uint32_t vda_next; /* Offset in bytes to next verdaux entry */
|
||||
};
|
||||
|
||||
struct Elf64_Verdaux
|
||||
{
|
||||
uint32_t vda_name; /* Version or dependency names */
|
||||
uint32_t vda_next; /* Offset in bytes to next verdaux entry */
|
||||
};
|
||||
|
||||
/* Version dependency section. */
|
||||
|
||||
struct Elf32_Verneed
|
||||
{
|
||||
uint16_t vn_version; /* Version of structure */
|
||||
uint16_t vn_cnt; /* Number of associated aux entries */
|
||||
uint32_t vn_file; /* Offset of filename for this dependency */
|
||||
uint32_t vn_aux; /* Offset in bytes to vernaux array */
|
||||
uint32_t vn_next; /* Offset in bytes to next verneed entry */
|
||||
};
|
||||
|
||||
struct Elf64_Verneed
|
||||
{
|
||||
uint16_t vn_version; /* Version of structure */
|
||||
uint16_t vn_cnt; /* Number of associated aux entries */
|
||||
uint32_t vn_file; /* Offset of filename for this dependency */
|
||||
uint32_t vn_aux; /* Offset in bytes to vernaux array */
|
||||
uint32_t vn_next; /* Offset in bytes to next verneed entry */
|
||||
};
|
||||
|
||||
/* Legal values for vn_version (version revision). */
|
||||
#define VER_NEED_NONE 0 /* No version */
|
||||
#define VER_NEED_CURRENT 1 /* Current version */
|
||||
#define VER_NEED_NUM 2 /* Given version number */
|
||||
|
||||
/* Auxiliary needed version information. */
|
||||
|
||||
struct Elf32_Vernaux
|
||||
{
|
||||
uint32_t vna_hash; /* Hash value of dependency name */
|
||||
uint16_t vna_flags; /* Dependency specific information */
|
||||
uint16_t vna_other; /* Unused */
|
||||
uint32_t vna_name; /* Dependency name string offset */
|
||||
uint32_t vna_next; /* Offset in bytes to next vernaux entry */
|
||||
};
|
||||
|
||||
struct Elf64_Vernaux
|
||||
{
|
||||
uint32_t vna_hash; /* Hash value of dependency name */
|
||||
uint16_t vna_flags; /* Dependency specific information */
|
||||
uint16_t vna_other; /* Unused */
|
||||
uint32_t vna_name; /* Dependency name string offset */
|
||||
uint32_t vna_next; /* Offset in bytes to next vernaux entry */
|
||||
};
|
||||
|
||||
#define R_386_NONE 0 /* relocation type */
|
||||
#define R_386_32 1
|
||||
#define R_386_PC32 2
|
||||
#define R_386_GOT32 3
|
||||
#define R_386_PLT32 4
|
||||
#define R_386_COPY 5
|
||||
#define R_386_GLOB_DAT 6
|
||||
#define R_386_JMP_SLOT 7
|
||||
#define R_386_RELATIVE 8
|
||||
#define R_386_GOTOFF 9
|
||||
#define R_386_GOTPC 10
|
||||
#define R_386_IRELATIVE 42
|
||||
|
||||
#define R_X86_64_IRELATIVE 37
|
||||
|
||||
#define ELF_PAGE_SIZE 0x1000
|
||||
|
||||
#ifndef PROT_NONE
|
||||
#define PROT_NONE 0x0 /* Page can not be accessed. */
|
||||
#define PROT_READ 0x1 /* Page can be read. */
|
||||
#define PROT_WRITE 0x2 /* Page can be written. */
|
||||
#define PROT_EXEC 0x4 /* Page can be executed. */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+5514
File diff suppressed because it is too large
Load Diff
+722
@@ -0,0 +1,722 @@
|
||||
#ifndef ELFFILE_H
|
||||
#define ELFFILE_H
|
||||
|
||||
class ELFFile;
|
||||
class ELFArchitecture;
|
||||
class ELFSegmentList;
|
||||
class ELFDirectoryList;
|
||||
class ELFImport;
|
||||
class ELFImportList;
|
||||
class ELFFixupList;
|
||||
class ELFSymbolList;
|
||||
class ELFExportList;
|
||||
class ELFSymbol;
|
||||
class ELFStringTable;
|
||||
class ELFRelocationList;
|
||||
class ELFSectionList;
|
||||
class ELFVerneedList;
|
||||
class ELFVerneed;
|
||||
class ELFVerdefList;
|
||||
class ELFVerdef;
|
||||
class ELFRuntimeFunctionList;
|
||||
class CommonInformationEntry;
|
||||
class CommonInformationEntryList;
|
||||
|
||||
class ELFSegment : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit ELFSegment(ELFSegmentList *owner);
|
||||
explicit ELFSegment(ELFSegmentList *owner, uint64_t address, uint64_t size, uint32_t physical_offset,
|
||||
uint32_t physical_size, uint32_t flags, uint32_t type, uint64_t alignment);
|
||||
explicit ELFSegment(ELFSegmentList *owner, const ELFSegment &src);
|
||||
virtual ELFSegment *Clone(ISectionList *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
virtual uint32_t type() const { return type_; }
|
||||
virtual void set_type(uint32_t type) { type_ = type; }
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return physical_offset_; }
|
||||
virtual uint32_t physical_size() const { return physical_size_; }
|
||||
virtual std::string name() const;
|
||||
virtual uint32_t memory_type() const;
|
||||
virtual void update_type(uint32_t mt);
|
||||
void set_size(uint64_t size) { size_ = size; }
|
||||
void set_physical_offset(uint32_t offset) { physical_offset_ = offset; }
|
||||
void set_physical_size(uint32_t size) { physical_size_ = size; }
|
||||
virtual uint32_t flags() const { return flags_; }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
uint64_t alignment() const { return alignment_; }
|
||||
uint32_t prot() const;
|
||||
private:
|
||||
uint32_t type_;
|
||||
uint64_t address_;
|
||||
uint64_t size_;
|
||||
uint32_t physical_offset_;
|
||||
uint32_t physical_size_;
|
||||
uint32_t flags_;
|
||||
uint64_t alignment_;
|
||||
};
|
||||
|
||||
class ELFSegmentList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit ELFSegmentList(ELFArchitecture *owner);
|
||||
explicit ELFSegmentList(ELFArchitecture *owner, const ELFSegmentList &src);
|
||||
virtual ELFSegmentList *Clone(ELFArchitecture *owner) const;
|
||||
virtual ELFSegment *GetSectionByAddress(uint64_t address) const;
|
||||
virtual ELFSegment *GetSectionByOffset(uint64_t offset) const;
|
||||
ELFSegment *GetSectionByType(uint32_t type) const;
|
||||
void ReadFromFile(ELFArchitecture &file, size_t count);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
ELFSegment *item(size_t index) const;
|
||||
ELFSegment *last() const;
|
||||
ELFSegment *Add(uint64_t address, uint64_t size, uint32_t physical_offset, uint32_t physical_size, uint32_t flags,
|
||||
uint32_t type, uint64_t alignment);
|
||||
private:
|
||||
ELFSegment *Add();
|
||||
};
|
||||
|
||||
class ELFSection : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit ELFSection(ELFSectionList *owner);
|
||||
explicit ELFSection(ELFSectionList *owner, uint64_t address, uint32_t size, uint32_t physical_offset, uint32_t flags, uint32_t type, const std::string &name);
|
||||
explicit ELFSection(ELFSectionList *owner, const ELFSection &src);
|
||||
virtual ELFSection *Clone(ISectionList *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void ReadName(ELFStringTable &string_table);
|
||||
void WriteName(ELFStringTable &string_table);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return physical_offset_; }
|
||||
virtual uint32_t physical_size() const { return size_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
virtual uint32_t memory_type() const { return parent_->memory_type(); }
|
||||
virtual ELFSegment *parent() const { return parent_; }
|
||||
virtual uint32_t flags() const { return static_cast<uint32_t>(flags_); }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
virtual void update_type(uint32_t mt) { }
|
||||
uint32_t type() const { return type_; }
|
||||
uint32_t link() const { return link_; }
|
||||
uint64_t entry_size() const { return entry_size_; }
|
||||
void set_physical_offset(uint32_t physical_offset) { physical_offset_ = physical_offset; }
|
||||
void set_size(uint32_t size) { size_ = size; }
|
||||
uint32_t alignment() const { return addralign_; }
|
||||
uint32_t info() const { return info_; }
|
||||
void set_info(uint32_t info) { info_ = info; }
|
||||
void set_link(uint32_t link) { link_ = link; }
|
||||
void set_entry_size(uint64_t entry_size) { entry_size_ = entry_size; }
|
||||
void RemapLinks(const std::map<size_t, size_t> &index_map);
|
||||
private:
|
||||
ELFSegment *parent_;
|
||||
uint64_t address_;
|
||||
uint32_t size_;
|
||||
uint32_t type_;
|
||||
uint32_t physical_offset_;
|
||||
uint32_t name_idx_;
|
||||
std::string name_;
|
||||
uint32_t link_;
|
||||
uint32_t info_;
|
||||
uint32_t addralign_;
|
||||
uint64_t flags_;
|
||||
uint64_t entry_size_;
|
||||
};
|
||||
|
||||
class ELFStringTable
|
||||
{
|
||||
public:
|
||||
ELFStringTable *Clone();
|
||||
std::string GetString(uint32_t pos) const;
|
||||
uint32_t AddString(const std::string &str);
|
||||
void clear();
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void ReadFromFile(ELFArchitecture &file, const ELFSection §ion);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
size_t size() const { return data_.size(); }
|
||||
private:
|
||||
std::vector<char> data_;
|
||||
std::map<std::string, uint32_t> map_;
|
||||
};
|
||||
|
||||
class ELFSectionList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit ELFSectionList(ELFArchitecture *owner);
|
||||
explicit ELFSectionList(ELFArchitecture *owner, const ELFSectionList &src);
|
||||
ELFSection *item(size_t index) const;
|
||||
virtual ELFSectionList *Clone(ELFArchitecture *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file, size_t count);
|
||||
uint64_t WriteToFile(ELFArchitecture &file);
|
||||
ELFSection *GetSectionByType(uint32_t type) const;
|
||||
ELFSection *GetSectionByAddress(uint64_t address) const;
|
||||
ELFSection *GetSectionByName(const std::string &name) const;
|
||||
ELFSection *Add(uint64_t address, uint32_t size, uint32_t physical_offset, uint32_t flags, uint32_t type, const std::string &name);
|
||||
ELFStringTable *string_table() { return &string_table_; }
|
||||
void RemapLinks(const std::map<size_t, size_t> &index_map);
|
||||
private:
|
||||
ELFSection *Add();
|
||||
|
||||
ELFStringTable string_table_;
|
||||
};
|
||||
|
||||
class ELFImportFunction : public BaseImportFunction
|
||||
{
|
||||
public:
|
||||
explicit ELFImportFunction(ELFImport *owner, uint64_t address, const std::string &name, ELFSymbol *symbol);
|
||||
explicit ELFImportFunction(ELFImport *owner, uint64_t address, APIType type, MapFunction *map_function);
|
||||
explicit ELFImportFunction(ELFImport *owner, const ELFImportFunction &src);
|
||||
virtual ELFImportFunction *Clone(IImport *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
ELFSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(ELFSymbol *symbol) { symbol_ = symbol; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
std::string name_;
|
||||
ELFSymbol *symbol_;
|
||||
};
|
||||
|
||||
class ELFImport : public BaseImport
|
||||
{
|
||||
public:
|
||||
explicit ELFImport(ELFImportList *owner, bool is_sdk = false);
|
||||
explicit ELFImport(ELFImportList *owner, const std::string &name);
|
||||
explicit ELFImport(ELFImportList *owner, const ELFImport &src);
|
||||
ELFImportFunction *item(size_t index) const;
|
||||
ELFImportFunction *GetFunctionBySymbol(ELFSymbol *symbol) const;
|
||||
virtual ELFImport *Clone(IImportList *owner) const;
|
||||
virtual std::string name() const { return name_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
virtual bool is_sdk() const { return is_sdk_; }
|
||||
void set_is_sdk(bool is_sdk) { is_sdk_ = is_sdk; }
|
||||
ELFImportFunction *Add(uint64_t address, const std::string &name, ELFSymbol *symbol);
|
||||
protected:
|
||||
virtual IImportFunction *Add(uint64_t address, APIType type, MapFunction *map_function);
|
||||
private:
|
||||
std::string name_;
|
||||
bool is_sdk_;
|
||||
};
|
||||
|
||||
class ELFImportList : public BaseImportList
|
||||
{
|
||||
public:
|
||||
explicit ELFImportList(ELFArchitecture *owner);
|
||||
explicit ELFImportList(ELFArchitecture *owner, const ELFImportList &src);
|
||||
virtual ELFImportList *Clone(ELFArchitecture *owner) const;
|
||||
ELFImport *item(size_t index) const;
|
||||
virtual ELFImportFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
virtual ELFImport *GetImportByName(const std::string &name) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void Pack();
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
protected:
|
||||
virtual ELFImport *AddSDK();
|
||||
private:
|
||||
ELFImport *Add(const std::string &name);
|
||||
};
|
||||
|
||||
class ELFFixup : public BaseFixup
|
||||
{
|
||||
public:
|
||||
explicit ELFFixup(ELFFixupList *owner, uint64_t address, OperandSize size);
|
||||
explicit ELFFixup(ELFFixupList *owner, const ELFFixup &src);
|
||||
virtual ELFFixup *Clone(IFixupList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual FixupType type() const { return ftHighLow; }
|
||||
virtual OperandSize size() const { return size_; }
|
||||
virtual void set_address(uint64_t address) { address_ = address; }
|
||||
virtual void Rebase(IArchitecture &file, uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
OperandSize size_;
|
||||
};
|
||||
|
||||
class ELFFixupList : public BaseFixupList
|
||||
{
|
||||
public:
|
||||
explicit ELFFixupList();
|
||||
explicit ELFFixupList(const ELFFixupList &src);
|
||||
virtual ELFFixupList *Clone() const;
|
||||
ELFFixup *item(size_t index) const;
|
||||
virtual IFixup *AddDefault(OperandSize cpu_address_size, bool is_code);
|
||||
ELFFixup *Add(uint64_t address, OperandSize size);
|
||||
void WriteToData(Data &data, uint64_t image_base);
|
||||
};
|
||||
|
||||
class ELFExport : public BaseExport
|
||||
{
|
||||
public:
|
||||
explicit ELFExport(IExportList *parent, uint64_t address);
|
||||
explicit ELFExport(IExportList *parent, ELFSymbol *symbol);
|
||||
explicit ELFExport(IExportList *parent, const ELFExport &src);
|
||||
~ELFExport();
|
||||
virtual ELFExport *Clone(IExportList *parent) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual std::string forwarded_name() const { return std::string(); }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
virtual APIType type() const { return type_; }
|
||||
virtual void set_type(APIType type) { type_ = type; }
|
||||
ELFSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(ELFSymbol *symbol) { symbol_ = symbol; }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
void set_address(uint64_t value) { address_ = value; }
|
||||
private:
|
||||
ELFSymbol *symbol_;
|
||||
uint64_t address_;
|
||||
std::string name_;
|
||||
APIType type_;
|
||||
};
|
||||
|
||||
class ELFExportList : public BaseExportList
|
||||
{
|
||||
public:
|
||||
explicit ELFExportList(ELFArchitecture *owner);
|
||||
explicit ELFExportList(ELFArchitecture *owner, const ELFExportList &src);
|
||||
virtual ELFExportList *Clone(ELFArchitecture *owner) const;
|
||||
ELFExport *item(size_t index) const;
|
||||
virtual std::string name() const { return std::string(); }
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
ELFExport *GetExportByAddress(uint64_t address) const;
|
||||
protected:
|
||||
virtual IExport *Add(uint64_t address);
|
||||
private:
|
||||
ELFExport *Add(ELFSymbol *symbol);
|
||||
};
|
||||
|
||||
class ELFSymbol : public ISymbol
|
||||
{
|
||||
public:
|
||||
explicit ELFSymbol(ELFSymbolList *owner);
|
||||
explicit ELFSymbol(ELFSymbolList *owner, const ELFSymbol &src);
|
||||
~ELFSymbol();
|
||||
virtual ELFSymbol *Clone(ELFSymbolList *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file, const ELFStringTable &strtab);
|
||||
size_t WriteToFile(ELFArchitecture &file, ELFStringTable &string_table);
|
||||
void Rebase(uint64_t delta_base);
|
||||
uint8_t type() const { return (info_ & 0x0f); }
|
||||
uint8_t bind() const { return (info_ >> 4); }
|
||||
void set_bind(uint8_t bind) { info_ = (bind << 4) | (info_ & 0x0f); }
|
||||
uint64_t address() const { return address_; }
|
||||
uint64_t value() const { return value_; }
|
||||
std::string name() const { return name_; }
|
||||
uint16_t section_idx() const { return section_idx_; }
|
||||
uint32_t name_idx() const { return name_idx_; }
|
||||
bool is_deleted() const { return is_deleted_; }
|
||||
void set_deleted(bool value) { is_deleted_ = value; }
|
||||
ELFSymbolList *owner() const { return owner_; }
|
||||
uint16_t version() const { return version_; }
|
||||
void set_version(uint16_t version) { version_ = version; }
|
||||
bool need_hash() const { return (type() == STT_TLS) || (value_ && section_idx_); }
|
||||
size_t size() const { return static_cast<size_t>(size_); }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
private:
|
||||
ELFSymbolList *owner_;
|
||||
uint64_t address_;
|
||||
std::string name_;
|
||||
uint8_t info_;
|
||||
uint8_t other_;
|
||||
uint16_t section_idx_;
|
||||
uint32_t name_idx_;
|
||||
uint64_t value_;
|
||||
uint64_t size_;
|
||||
bool is_deleted_;
|
||||
uint16_t version_;
|
||||
};
|
||||
|
||||
class ELFSymbolList : public ObjectList<ELFSymbol>
|
||||
{
|
||||
public:
|
||||
explicit ELFSymbolList(bool is_dynamic);
|
||||
explicit ELFSymbolList(const ELFSymbolList &src);
|
||||
virtual ELFSymbolList *Clone() const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void Pack();
|
||||
void Rebase(uint64_t delta_base);
|
||||
ELFStringTable *string_table() { return &string_table_; }
|
||||
private:
|
||||
ELFSymbol *Add();
|
||||
size_t WriteHash(ELFArchitecture &file);
|
||||
template <typename T>
|
||||
size_t WriteGNUHash(ELFArchitecture &file);
|
||||
size_t WriteVersym(ELFArchitecture &file);
|
||||
|
||||
bool is_dynamic_;
|
||||
ELFStringTable string_table_;
|
||||
|
||||
// no assignment op
|
||||
ELFSymbolList &operator =(const ELFSymbolList &);
|
||||
};
|
||||
|
||||
class ELFVernaux : public IObject
|
||||
{
|
||||
public:
|
||||
ELFVernaux(ELFVerneed *owner);
|
||||
ELFVernaux(ELFVerneed *owner, const ELFVernaux &src);
|
||||
~ELFVernaux();
|
||||
ELFVernaux *Clone(ELFVerneed *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
uint32_t next() const { return next_; }
|
||||
uint32_t hash() const { return hash_; }
|
||||
uint16_t other() const { return other_; }
|
||||
void set_other(uint16_t other) { other_ = other; }
|
||||
private:
|
||||
ELFVerneed *owner_;
|
||||
uint32_t hash_;
|
||||
uint16_t flags_;
|
||||
uint16_t other_;
|
||||
uint32_t name_pos_;
|
||||
uint32_t next_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class ELFVerneed : public ObjectList<ELFVernaux>
|
||||
{
|
||||
public:
|
||||
ELFVerneed(ELFVerneedList *owner);
|
||||
ELFVerneed(ELFVerneedList *owner, const ELFVerneed &src);
|
||||
~ELFVerneed();
|
||||
ELFVerneed *Clone(ELFVerneedList *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
ELFVernaux *GetVernaux(uint32_t hash) const;
|
||||
uint32_t next() const { return next_; }
|
||||
std::string file() const { return file_; }
|
||||
private:
|
||||
ELFVernaux *Add();
|
||||
|
||||
ELFVerneedList *owner_;
|
||||
uint16_t version_;
|
||||
uint32_t file_pos_;
|
||||
uint32_t next_;
|
||||
std::string file_;
|
||||
};
|
||||
|
||||
class ELFVerneedList : public ObjectList<ELFVerneed>
|
||||
{
|
||||
public:
|
||||
explicit ELFVerneedList();
|
||||
explicit ELFVerneedList(const ELFVerneedList &src);
|
||||
ELFVerneedList *Clone() const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
ELFVerneed *GetVerneed(const std::string &name) const;
|
||||
private:
|
||||
ELFVerneed *Add();
|
||||
};
|
||||
|
||||
class ELFVerdaux : public IObject
|
||||
{
|
||||
public:
|
||||
ELFVerdaux(ELFVerdef *owner);
|
||||
ELFVerdaux(ELFVerdef *owner, const ELFVerdaux &src);
|
||||
~ELFVerdaux();
|
||||
ELFVerdaux *Clone(ELFVerdef *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
uint32_t next() const { return next_; }
|
||||
private:
|
||||
ELFVerdef *owner_;
|
||||
uint32_t name_pos_;
|
||||
uint32_t next_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class ELFVerdef : public ObjectList<ELFVerdaux>
|
||||
{
|
||||
public:
|
||||
ELFVerdef(ELFVerdefList *owner);
|
||||
ELFVerdef(ELFVerdefList *owner, const ELFVerdef &src);
|
||||
~ELFVerdef();
|
||||
ELFVerdef *Clone(ELFVerdefList *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
uint32_t next() const { return next_; }
|
||||
private:
|
||||
ELFVerdaux *Add();
|
||||
|
||||
ELFVerdefList *owner_;
|
||||
uint16_t version_;
|
||||
uint16_t flags_;
|
||||
uint16_t ndx_;
|
||||
uint32_t hash_;
|
||||
uint32_t next_;
|
||||
};
|
||||
|
||||
class ELFVerdefList : public ObjectList<ELFVerdef>
|
||||
{
|
||||
public:
|
||||
explicit ELFVerdefList();
|
||||
explicit ELFVerdefList(const ELFVerdefList &src);
|
||||
ELFVerdefList *Clone() const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
private:
|
||||
ELFVerdef *Add();
|
||||
};
|
||||
|
||||
class ELFRelocation : public BaseRelocation
|
||||
{
|
||||
public:
|
||||
explicit ELFRelocation(ELFRelocationList *owner, bool is_rela, uint64_t address, OperandSize size, uint32_t type, ELFSymbol *symbol, uint64_t addend);
|
||||
explicit ELFRelocation(ELFRelocationList *owner, const ELFRelocation &src);
|
||||
ELFRelocation *Clone(IRelocationList *owner) const;
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
virtual void Rebase(IArchitecture &file, uint64_t delta_base);
|
||||
ELFSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(ELFSymbol *symbol) { symbol_ = symbol; }
|
||||
bool is_rela() const { return is_rela_; }
|
||||
uint32_t type() const { return type_; }
|
||||
void set_type(uint32_t type) { type_ = type; }
|
||||
uint64_t addend() const { return addend_; }
|
||||
uint64_t value() const { return value_; }
|
||||
void set_value(uint64_t value) { value_ = value; }
|
||||
private:
|
||||
bool is_rela_;
|
||||
uint32_t type_;
|
||||
uint64_t addend_;
|
||||
ELFSymbol *symbol_;
|
||||
uint64_t value_;
|
||||
};
|
||||
|
||||
class ELFRelocationList : public BaseRelocationList
|
||||
{
|
||||
public:
|
||||
explicit ELFRelocationList();
|
||||
explicit ELFRelocationList(const ELFRelocationList &src);
|
||||
virtual ELFRelocationList *Clone() const;
|
||||
ELFRelocation *item(size_t index) const;
|
||||
ELFRelocation *GetRelocationByAddress(uint64_t address) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void Pack();
|
||||
private:
|
||||
ELFRelocation *Add(bool is_rela, uint64_t address, OperandSize size, uint32_t type, ELFSymbol *symbol, uint64_t addend);
|
||||
|
||||
// no assignment op
|
||||
ELFRelocationList &operator =(const ELFRelocationList &);
|
||||
};
|
||||
|
||||
class ELFDirectory : public BaseLoadCommand
|
||||
{
|
||||
public:
|
||||
explicit ELFDirectory(ELFDirectoryList *owner);
|
||||
explicit ELFDirectory(ELFDirectoryList *owner, size_t type);
|
||||
explicit ELFDirectory(ELFDirectoryList *owner, const ELFDirectory &src);
|
||||
virtual ELFDirectory *Clone(ILoadCommandList *owner) const;
|
||||
virtual uint64_t address() const { return value_; }
|
||||
virtual uint32_t size() const { return 0; }
|
||||
virtual uint32_t type() const { return static_cast<uint32_t>(type_); }
|
||||
virtual std::string name() const;
|
||||
uint64_t value() const { return value_; }
|
||||
void set_value(uint64_t value) { value_ = value; }
|
||||
std::string str_value() const { return str_value_; }
|
||||
void set_str_value(const std::string &str_value) { str_value_ = str_value; }
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
size_t WriteToFile(ELFArchitecture &file);
|
||||
void ReadStrings(ELFStringTable &string_table);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
uint64_t type_;
|
||||
uint64_t value_;
|
||||
std::string str_value_;
|
||||
};
|
||||
|
||||
class ELFDirectoryList : public BaseCommandList
|
||||
{
|
||||
public:
|
||||
explicit ELFDirectoryList(ELFArchitecture *owner);
|
||||
explicit ELFDirectoryList(ELFArchitecture *owner, const ELFDirectoryList &src);
|
||||
ELFDirectory *item(size_t index) const;
|
||||
virtual ELFDirectoryList *Clone(ELFArchitecture *owner) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
ELFDirectory *Add(size_t type);
|
||||
ELFDirectory *GetCommandByType(uint32_t type) const;
|
||||
void ReadStrings(ELFStringTable &string_table);
|
||||
void WriteStrings(ELFStringTable &string_table);
|
||||
private:
|
||||
ELFDirectory *Add();
|
||||
|
||||
// no assignment op
|
||||
ELFRelocationList &operator =(const ELFRelocationList &);
|
||||
};
|
||||
|
||||
class ELFRuntimeFunction : public BaseRuntimeFunction
|
||||
{
|
||||
public:
|
||||
explicit ELFRuntimeFunction(ELFRuntimeFunctionList *owner, uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, CommonInformationEntry *cie,
|
||||
const std::vector<uint8_t> &call_frame_instructions);
|
||||
explicit ELFRuntimeFunction(ELFRuntimeFunctionList *owner, const ELFRuntimeFunction &src);
|
||||
virtual ELFRuntimeFunction *Clone(IRuntimeFunctionList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t begin() const { return begin_; }
|
||||
virtual uint64_t end() const { return end_; }
|
||||
virtual uint64_t unwind_address() const { return unwind_address_; }
|
||||
virtual void set_begin(uint64_t begin) { begin_ = begin; }
|
||||
virtual void set_end(uint64_t end) { end_ = end; }
|
||||
virtual void set_unwind_address(uint64_t unwind_address) { unwind_address_ = unwind_address; }
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
CommonInformationEntry *cie() const { return cie_; }
|
||||
void set_cie(CommonInformationEntry *cie) { cie_ = cie; }
|
||||
std::vector<uint8_t> call_frame_instructions() const { return call_frame_instructions_; }
|
||||
virtual void Parse(IArchitecture &file, IFunction &dest);
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint64_t begin_;
|
||||
uint64_t end_;
|
||||
uint64_t unwind_address_;
|
||||
CommonInformationEntry *cie_;
|
||||
std::vector<uint8_t> call_frame_instructions_;
|
||||
};
|
||||
|
||||
class ELFRuntimeFunctionList : public BaseRuntimeFunctionList
|
||||
{
|
||||
public:
|
||||
explicit ELFRuntimeFunctionList();
|
||||
explicit ELFRuntimeFunctionList(const ELFRuntimeFunctionList &src);
|
||||
~ELFRuntimeFunctionList();
|
||||
virtual void clear();
|
||||
ELFRuntimeFunctionList *Clone() const;
|
||||
ELFRuntimeFunction *item(size_t index) const;
|
||||
void ReadFromFile(ELFArchitecture &file);
|
||||
void WriteToFile(ELFArchitecture &file);
|
||||
void Rebase(uint64_t delta_base);
|
||||
virtual ELFRuntimeFunction *Add(uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, IRuntimeFunction *source, const std::vector<uint8_t> &call_frame_instructions);
|
||||
virtual ELFRuntimeFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
CommonInformationEntryList *cie_list() const { return cie_list_; }
|
||||
private:
|
||||
ELFRuntimeFunction *Add(uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, CommonInformationEntry *cie, const std::vector<uint8_t> &call_frame_instructions);
|
||||
|
||||
CommonInformationEntryList *cie_list_;
|
||||
uint8_t version_;
|
||||
uint8_t eh_frame_encoding_;
|
||||
uint8_t fde_count_encoding_;
|
||||
uint8_t fde_table_encoding_;
|
||||
|
||||
// no assignment op
|
||||
ELFRuntimeFunctionList &operator =(const ELFRuntimeFunctionList &);
|
||||
};
|
||||
|
||||
class ELFArchitecture : public BaseArchitecture
|
||||
{
|
||||
public:
|
||||
explicit ELFArchitecture(ELFFile *owner, uint64_t offset, uint64_t size);
|
||||
explicit ELFArchitecture(ELFFile *owner, const ELFArchitecture &src);
|
||||
virtual ~ELFArchitecture();
|
||||
virtual std::string name() const;
|
||||
virtual uint32_t type() const { return cpu_; }
|
||||
virtual OperandSize cpu_address_size() const { return cpu_address_size_; }
|
||||
virtual uint64_t entry_point() const { return entry_point_; }
|
||||
virtual uint64_t image_base() const { return image_base_; }
|
||||
uint16_t file_type() const { return file_type_; }
|
||||
uint32_t segment_alignment() const { return segment_alignment_; }
|
||||
uint32_t file_alignment() const { return file_alignment_; }
|
||||
virtual ELFDirectoryList *command_list() const { return directory_list_; }
|
||||
virtual ELFSegmentList *segment_list() const { return segment_list_; }
|
||||
virtual ELFImportList *import_list() const { return import_list_; }
|
||||
virtual ELFExportList *export_list() const { return export_list_; }
|
||||
virtual ELFFixupList *fixup_list() const { return fixup_list_; }
|
||||
virtual ELFRelocationList *relocation_list() const { return relocation_list_; }
|
||||
virtual IResourceList *resource_list() const { return NULL; }
|
||||
virtual ISEHandlerList *seh_handler_list() const { return NULL; }
|
||||
virtual ELFRuntimeFunctionList *runtime_function_list() const { return runtime_function_list_; }
|
||||
virtual IFunctionList *function_list() const { return function_list_; }
|
||||
virtual IVirtualMachineList *virtual_machine_list() const { return virtual_machine_list_; }
|
||||
virtual ELFSectionList *section_list() const { return section_list_; }
|
||||
OpenStatus ReadFromFile(uint32_t mode);
|
||||
virtual bool WriteToFile();
|
||||
virtual IArchitecture *Clone(IFile *file) const;
|
||||
virtual ELFArchitecture *Clone(ELFFile *file) const;
|
||||
virtual void Save(CompileContext &ctx);
|
||||
virtual bool is_executable() const;
|
||||
size_t shstrndx() { return shstrndx_; }
|
||||
virtual CallingConvention calling_convention() const { return cpu_address_size() == osDWord ? ccCdecl : ccABIx64; }
|
||||
void Rebase(uint64_t delta_base);
|
||||
ELFSymbolList *dynsymbol_list() const { return dynsymbol_list_; }
|
||||
ELFSymbolList *symbol_list() const { return symbol_list_; }
|
||||
ELFVerneedList *verneed_list() const { return verneed_list_; }
|
||||
ELFVerdefList *verdef_list() const { return verdef_list_; }
|
||||
ELFSegment *header_segment() const { return header_segment_; }
|
||||
uint32_t max_header_size() const { return header_size_ + resize_header_; }
|
||||
protected:
|
||||
virtual bool Prepare(CompileContext &ctx);
|
||||
private:
|
||||
ELFDirectoryList *directory_list_;
|
||||
ELFSegmentList *segment_list_;
|
||||
ELFSectionList *section_list_;
|
||||
ELFImportList *import_list_;
|
||||
ELFExportList *export_list_;
|
||||
ELFFixupList *fixup_list_;
|
||||
ELFRelocationList *relocation_list_;
|
||||
ELFRuntimeFunctionList *runtime_function_list_;
|
||||
IFunctionList *function_list_;
|
||||
IVirtualMachineList *virtual_machine_list_;
|
||||
|
||||
uint16_t cpu_;
|
||||
uint16_t file_type_;
|
||||
OperandSize cpu_address_size_;
|
||||
uint64_t image_base_;
|
||||
uint64_t entry_point_;
|
||||
uint32_t segment_alignment_;
|
||||
uint32_t file_alignment_;
|
||||
uint16_t shstrndx_;
|
||||
uint64_t shoff_;
|
||||
uint32_t header_offset_;
|
||||
uint32_t header_size_;
|
||||
uint32_t resize_header_;
|
||||
ELFSymbolList *dynsymbol_list_;
|
||||
ELFSymbolList *symbol_list_;
|
||||
ELFVerneedList *verneed_list_;
|
||||
ELFVerdefList *verdef_list_;
|
||||
ELFSegment *header_segment_;
|
||||
uint64_t overlay_offset_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ELFArchitecture(const ELFArchitecture &);
|
||||
ELFArchitecture &operator =(const ELFArchitecture &);
|
||||
};
|
||||
|
||||
class ELFFile : public IFile
|
||||
{
|
||||
public:
|
||||
explicit ELFFile(ILog *log);
|
||||
explicit ELFFile(const ELFFile &src, const char *file_name);
|
||||
virtual ~ELFFile();
|
||||
virtual std::string format_name() const;
|
||||
ELFArchitecture *item(size_t index) const;
|
||||
ELFFile *Clone(const char *file_name) const;
|
||||
virtual bool Compile(CompileOptions &options);
|
||||
virtual bool is_executable() const;
|
||||
virtual uint32_t disable_options() const;
|
||||
protected:
|
||||
virtual OpenStatus ReadHeader(uint32_t open_mode);
|
||||
virtual IFile *runtime() const { return runtime_; }
|
||||
private:
|
||||
ELFArchitecture *Add(uint64_t offset, uint64_t size);
|
||||
|
||||
ELFFile *runtime_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ELFFile(const ELFFile &);
|
||||
ELFFile &operator =(const ELFFile &);
|
||||
};
|
||||
|
||||
#endif
|
||||
+4158
File diff suppressed because it is too large
Load Diff
+1698
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
call %1core\lang.bat %1
|
||||
call %1core\version.bat %1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
+7841
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,855 @@
|
||||
#ifndef IL_H
|
||||
#define IL_H
|
||||
|
||||
enum ILCommandType {
|
||||
icUnknown, icByte, icWord, icDword, icQword, icComment, icData, icCase,
|
||||
icNop, icBreak, icLdarg_0, icLdarg_1, icLdarg_2, icLdarg_3, icLdloc_0, icLdloc_1, icLdloc_2, icLdloc_3, icStloc_0, icStloc_1,
|
||||
icStloc_2, icStloc_3, icLdarg_s, icLdarga_s, icStarg_s, icLdloc_s, icLdloca_s, icStloc_s, icLdnull, icLdc_i4_m1, icLdc_i4_0,
|
||||
icLdc_i4_1, icLdc_i4_2, icLdc_i4_3, icLdc_i4_4, icLdc_i4_5, icLdc_i4_6, icLdc_i4_7, icLdc_i4_8, icLdc_i4_s, icLdc_i4, icLdc_i8,
|
||||
icLdc_r4, icLdc_r8, icDup, icPop, icJmp, icCall, icCalli, icRet, icBr_s, icBrfalse_s, icBrtrue_s, icBeq_s, icBge_s, icBgt_s, icBle_s,
|
||||
icBlt_s, icBne_un_s, icBge_un_s, icBgt_un_s, icBle_un_s, icBlt_un_s, icBr, icBrfalse, icBrtrue, icBeq, icBge, icBgt, icBle, icBlt,
|
||||
icBne_un, icBge_un, icBgt_un, icBle_un, icBlt_un, icSwitch, icLdind_i1, icLdind_u1, icLdind_i2, icLdind_u2, icLdind_i4, icLdind_u4,
|
||||
icLdind_i8, icLdind_i, icLdind_r4, icLdind_r8, icLdind_ref, icStind_ref, icStind_i1, icStind_i2, icStind_i4, icStind_i8, icStind_r4,
|
||||
icStind_r8, icAdd, icSub, icMul, icDiv, icDiv_un, icRem, icRem_un, icAnd, icOr, icXor, icShl, icShr, icShr_un, icNeg, icNot, icConv_i1, icConv_i2,
|
||||
icConv_i4, icConv_i8, icConv_r4, icConv_r8, icConv_u4, icConv_u8, icCallvirt, icCpobj, icLdobj, icLdstr, icNewobj, icCastclass,
|
||||
icIsinst, icConv_r_un, icUnbox, icThrow, icLdfld, icLdflda, icStfld, icLdsfld, icLdsflda, icStsfld, icStobj, icConv_ovf_i1_un,
|
||||
icConv_ovf_i2_un, icConv_ovf_i4_un, icConv_ovf_i8_un, icConv_ovf_u1_un, icConv_ovf_u2_un, icConv_ovf_u4_un, icConv_ovf_u8_un,
|
||||
icConv_ovf_i_un, icConv_ovf_u_un, icBox, icNewarr, icLdlen, icLdelema, icLdelem_i1, icLdelem_u1, icLdelem_i2, icLdelem_u2,
|
||||
icLdelem_i4, icLdelem_u4, icLdelem_i8, icLdelem_i, icLdelem_r4, icLdelem_r8, icLdelem_ref, icStelem_i, icStelem_i1, icStelem_i2,
|
||||
icStelem_i4, icStelem_i8, icStelem_r4, icStelem_r8, icStelem_ref, icLdelem, icStelem, icUnbox_any, icConv_ovf_i1, icConv_ovf_u1,
|
||||
icConv_ovf_i2, icConv_ovf_u2, icConv_ovf_i4, icConv_ovf_u4, icConv_ovf_i8, icConv_ovf_u8, icRefanyval, icCkfinite, icMkrefany,
|
||||
icLdtoken, icConv_u2, icConv_u1, icConv_i, icConv_ovf_i, icConv_ovf_u, icAdd_ovf, icAdd_ovf_un, icMul_ovf, icMul_ovf_un, icSub_ovf,
|
||||
icSub_ovf_un, icEndfinally, icLeave, icLeave_s, icStind_i, icConv_u, icArglist, icCeq, icCgt, icCgt_un, icClt, icClt_un, icLdftn, icLdvirtftn,
|
||||
icLdarg, icLdarga, icStarg, icLdloc, icLdloca, icStloc, icLocalloc, icEndfilter, icUnaligned, icVolatile, icTail, icInitobj, icConstrained,
|
||||
icCpblk, icInitblk, icNo, icRethrow, icSizeof, icRefanytype, icReadonly,
|
||||
icConv, icConv_ovf, icConv_ovf_un, icLdmem_i4, icInitarg, icInitcatchblock, icEntertry, icCallvm, icCallvmvirt,
|
||||
icCmp, icCmp_un,
|
||||
icCNT
|
||||
};
|
||||
|
||||
enum ILFlowControl : uint8_t
|
||||
{
|
||||
Branch,
|
||||
Break,
|
||||
Call,
|
||||
Cond_Branch,
|
||||
Meta, // Provides information about a subsequent instruction. For example, the Unaligned instruction of Reflection.Emit.Opcodes has FlowControl.Meta and specifies that the subsequent pointer instruction might be unaligned.
|
||||
Next, // Normal flow of control
|
||||
Phi, // Obsolete. This enumerator value is reserved and should not be used.
|
||||
Return,
|
||||
Throw
|
||||
};
|
||||
|
||||
enum ILOpCodeType : uint8_t
|
||||
{
|
||||
Experimental, // Reserved (ECMA) instruction
|
||||
Macro, // synonym for other MSIL instructions (ldarg.0 - ldarg)
|
||||
Reserved, // Reserved (ECMA) instruction
|
||||
Objmodel, // Instruction that applies to objects
|
||||
Prefix, // Prefix instruction that modifies the behavior of the following instruction
|
||||
Primitive // Built-in instruction
|
||||
};
|
||||
|
||||
enum ILOperandType : uint8_t// The operand is a ...
|
||||
{
|
||||
InlineBrTarget, // 32-bit integer branch target
|
||||
InlineField, // 32-bit metadata token
|
||||
InlineI, // 32-bit integer
|
||||
InlineI8, // 64-bit integer
|
||||
InlineMethod, // 32-bit metadata token
|
||||
InlineNone, // No operand
|
||||
InlinePhi, // Obsolete. The operand is reserved and should not be used.
|
||||
InlineR, // 64-bit IEEE floating point number
|
||||
Inline8, // not used
|
||||
InlineSig, // 32-bit metadata signature token
|
||||
InlineString, // 32-bit metadata string token
|
||||
InlineSwitch, // 32-bit integer argument to a switch instruction
|
||||
InlineTok, // FieldRef, MethodRef, or TypeRef token
|
||||
InlineType, // 32-bit metadata token
|
||||
InlineVar, // 16-bit integer containing the ordinal of a local variable or an argument
|
||||
ShortInlineBrTarget, // 8-bit integer branch target
|
||||
ShortInlineI, // 8-bit integer
|
||||
ShortInlineR, // 32-bit IEEE floating point number
|
||||
ShortInlineVar, // 8-bit integer containing the ordinal of a local variable or an argument
|
||||
};
|
||||
|
||||
enum ILStackBehaviour : uint8_t
|
||||
{
|
||||
Pop0, // No values are popped off the stack.
|
||||
Pop1, // Pops one value off the stack.
|
||||
Pop1_pop1, // Pops 1 value off the stack for the first operand, and 1 value of the stack for the second operand.
|
||||
Popi, // Pops a 32-bit integer off the stack.
|
||||
Popi_pop1, // Pops a 32-bit integer off the stack for the first operand, and a value off the stack for the second operand.
|
||||
Popi_popi, // Pops a 32-bit integer off the stack for the first operand, and a 32-bit integer off the stack for the second operand.
|
||||
Popi_popi8, // Pops a 32-bit integer off the stack for the first operand, and a 64-bit integer off the stack for the second operand.
|
||||
Popi_popi_popi, // Pops a 32-bit integer off the stack for the first operand, a 32-bit integer off the stack for the second operand, and a 32-bit integer off the stack for the third operand.
|
||||
Popi_popr4, // Pops a 32-bit integer off the stack for the first operand, and a 32-bit floating point number off the stack for the second operand.
|
||||
Popi_popr8, // Pops a 32-bit integer off the stack for the first operand, and a 64-bit floating point number off the stack for the second operand.
|
||||
Popref, // Pops a reference off the stack.
|
||||
Popref_pop1, // Pops a reference off the stack for the first operand, and a value off the stack for the second operand.
|
||||
Popref_popi, // Pops a reference off the stack for the first operand, and a 32-bit integer off the stack for the second operand.
|
||||
Popref_popi_popi, // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a value off the stack for the third operand.
|
||||
Popref_popi_popi8, // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 64-bit integer off the stack for the third operand.
|
||||
Popref_popi_popr4, // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 32-bit integer off the stack for the third operand.
|
||||
Popref_popi_popr8, // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 64-bit floating point number off the stack for the third operand.
|
||||
Popref_popi_popref, // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a reference off the stack for the third operand.
|
||||
Push0, // No values are pushed onto the stack.
|
||||
Push1, // Pushes one value onto the stack.
|
||||
Push1_push1, // Pushes 1 value onto the stack for the first operand, and 1 value onto the stack for the second operand.
|
||||
Pushi, // Pushes a 32-bit integer onto the stack.
|
||||
Pushi8, // Pushes a 64-bit integer onto the stack.
|
||||
Pushr4, // Pushes a 32-bit floating point number onto the stack.
|
||||
Pushr8, // Pushes a 64-bit floating point number onto the stack.
|
||||
Pushref, // Pushes a reference onto the stack.
|
||||
Varpop, // Pops a variable off the stack.
|
||||
Varpush, // Pushes a variable onto the stack.
|
||||
Popref_popi_pop1 // Pops a reference off the stack for the first operand, a value off the stack for the second operand, and a 32-bit integer off the stack for the third operand.
|
||||
};
|
||||
|
||||
struct ILOpCode {
|
||||
const char *name;
|
||||
ILStackBehaviour pop;
|
||||
ILStackBehaviour push;
|
||||
ILOperandType operand_type;
|
||||
ILOpCodeType opcode_type;
|
||||
ILFlowControl flow_type;
|
||||
bool is_ret;
|
||||
int stack_change;
|
||||
} const ILOpCodes[icCNT] = {
|
||||
{".byte ??", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{".byte", Pop0, Push0, ShortInlineI, Primitive, Next, false, 0},
|
||||
{".word", Pop0, Push0, InlineVar, Primitive, Next, false, 0},
|
||||
{".dword", Pop0, Push0, InlineI, Primitive, Next, false, 0},
|
||||
{".qword", Pop0, Push0, InlineI8, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{".byte", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineI, Primitive, Next, false, 0},
|
||||
{"nop", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"break", Pop0, Push0, InlineNone, Primitive, Break, false, 0},
|
||||
{"ldarg.0", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldarg.1", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldarg.2", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldarg.3", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldloc.0", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldloc.1", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldloc.2", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"ldloc.3", Pop0, Push1, InlineNone, Macro, Next, false, 1},
|
||||
{"stloc.0", Pop1, Push0, InlineNone, Macro, Next, false, -1},
|
||||
{"stloc.1", Pop1, Push0, InlineNone, Macro, Next, false, -1},
|
||||
{"stloc.2", Pop1, Push0, InlineNone, Macro, Next, false, -1},
|
||||
{"stloc.3", Pop1, Push0, InlineNone, Macro, Next, false, -1},
|
||||
{"ldarg.s", Pop0, Push1, ShortInlineVar, Macro, Next, false, 1},
|
||||
{"ldarga.s", Pop0, Pushi, ShortInlineVar, Macro, Next, false, 1},
|
||||
{"starg.s", Pop1, Push0, ShortInlineVar, Macro, Next, false, -1},
|
||||
{"ldloc.s", Pop0, Push1, ShortInlineVar, Macro, Next, false, 1},
|
||||
{"ldloca.s", Pop0, Pushi, ShortInlineVar, Macro, Next, false, 1},
|
||||
{"stloc.s", Pop1, Push0, ShortInlineVar, Macro, Next, false, -1},
|
||||
{"ldnull", Pop0, Pushref, InlineNone, Primitive, Next, false, 1},
|
||||
{"ldc.i4.m1", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.0", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.1", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.2", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.3", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.4", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.5", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.6", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.7", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.8", Pop0, Pushi, InlineNone, Macro, Next, false, 1},
|
||||
{"ldc.i4.s", Pop0, Pushi, ShortInlineI, Macro, Next, false, 1},
|
||||
{"ldc.i4", Pop0, Pushi, InlineI, Primitive, Next, false, 1},
|
||||
{"ldc.i8", Pop0, Pushi8, InlineI8, Primitive, Next, false, 1},
|
||||
{"ldc.r4", Pop0, Pushr4, ShortInlineR, Primitive, Next, false, 1},
|
||||
{"ldc.r8", Pop0, Pushr8, InlineR, Primitive, Next, false, 1},
|
||||
{"dup", Pop1, Push1_push1, InlineNone, Primitive, Next, false, 1},
|
||||
{"pop", Pop1, Push0, InlineNone, Primitive, Next, false, -1},
|
||||
{"jmp", Pop0, Push0, InlineMethod, Primitive, Call, true, 0},
|
||||
{"call", Varpop, Varpush, InlineMethod, Primitive, Call, false, 0},
|
||||
{"calli", Varpop, Varpush, InlineSig, Primitive, Call, false, 0},
|
||||
{"ret", Varpop, Push0, InlineNone, Primitive, Return, true, 0},
|
||||
{"br.s", Pop0, Push0, ShortInlineBrTarget, Macro, Branch, true, 0},
|
||||
{"brfalse.s", Popi, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -1},
|
||||
{"brtrue.s", Popi, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -1},
|
||||
{"beq.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bge.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bgt.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"ble.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"blt.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bne.un.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bge.un.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bgt.un.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"ble.un.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"blt.un.s", Pop1_pop1, Push0, ShortInlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"br", Pop0, Push0, InlineBrTarget, Primitive, Branch, true, 0},
|
||||
{"brfalse", Popi, Push0, InlineBrTarget, Primitive, Cond_Branch, false, -1},
|
||||
{"brtrue", Popi, Push0, InlineBrTarget, Primitive, Cond_Branch, false, -1},
|
||||
{"beq", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bge", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bgt", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"ble", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"blt", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bne.un", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bge.un", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"bgt.un", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"ble.un", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"blt.un", Pop1_pop1, Push0, InlineBrTarget, Macro, Cond_Branch, false, -2},
|
||||
{"switch", Popi, Push0, InlineSwitch, Primitive, Cond_Branch, false, -1},
|
||||
{"ldind.i1", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.u1", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.i2", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.u2", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.i4", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.u4", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.i8", Popi, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.i", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.r4", Popi, Pushr4, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.r8", Popi, Pushr8, InlineNone, Primitive, Next, false, 0},
|
||||
{"ldind.ref", Popi, Pushref, InlineNone, Primitive, Next, false, 0},
|
||||
{"stind.ref", Popi_popi, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.i1", Popi_popi, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.i2", Popi_popi, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.i4", Popi_popi, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.i8", Popi_popi8, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.r4", Popi_popr4, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"stind.r8", Popi_popr8, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"add", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"sub", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"mul", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"div", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"div.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"rem", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"rem.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"and", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"or", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"xor", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"shl", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"shr", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"shr.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"neg", Pop1, Push1, InlineNone, Primitive, Next, false, 0},
|
||||
{"not", Pop1, Push1, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.i1", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.i2", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.i4", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.i8", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.r4", Pop1, Pushr4, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.r8", Pop1, Pushr8, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.u4", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.u8", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"callvirt", Varpop, Varpush, InlineMethod, Objmodel, Call, false, 0},
|
||||
{"cpobj", Popi_popi, Push0, InlineType, Objmodel, Next, false, -2},
|
||||
{"ldobj", Popi, Push1, InlineType, Objmodel, Next, false, 0},
|
||||
{"ldstr", Pop0, Pushref, InlineString, Objmodel, Next, false, 1},
|
||||
{"newobj", Varpop, Pushref, InlineMethod, Objmodel, Call, false, 1},
|
||||
{"castclass", Popref, Pushref, InlineType, Objmodel, Next, false, 0},
|
||||
{"isinst", Popref, Pushi, InlineType, Objmodel, Next, false, 0},
|
||||
{"conv.r.un", Pop1, Pushr8, InlineNone, Primitive, Next, false, 0},
|
||||
{"unbox", Popref, Pushi, InlineType, Primitive, Next, false, 0},
|
||||
{"throw", Popref, Push0, InlineNone, Objmodel, Throw, true, -1},
|
||||
{"ldfld", Popref, Push1, InlineField, Objmodel, Next, false, 0},
|
||||
{"ldflda", Popref, Pushi, InlineField, Objmodel, Next, false, 0},
|
||||
{"stfld", Popref_pop1, Push0, InlineField, Objmodel, Next, false, -2},
|
||||
{"ldsfld", Pop0, Push1, InlineField, Objmodel, Next, false, 1},
|
||||
{"ldsflda", Pop0, Pushi, InlineField, Objmodel, Next, false, 1},
|
||||
{"stsfld", Pop1, Push0, InlineField, Objmodel, Next, false, -1},
|
||||
{"stobj", Popi_pop1, Push0, InlineType, Primitive, Next, false, -2},
|
||||
{"conv.ovf.i1.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i2.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i4.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i8.un", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u1.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u2.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u4.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u8.un", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u.un", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"box", Pop1, Pushref, InlineType, Primitive, Next, false, 0},
|
||||
{"newarr", Popi, Pushref, InlineType, Objmodel, Next, false, 0},
|
||||
{"ldlen", Popref, Pushi, InlineNone, Objmodel, Next, false, 0},
|
||||
{"ldelema", Popref_popi, Pushi, InlineType, Objmodel, Next, false, -1},
|
||||
{"ldelem.i1", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.u1", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.i2", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.u2", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.i4", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.u4", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.i8", Popref_popi, Pushi8, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.i", Popref_popi, Pushi, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.r4", Popref_popi, Pushr4, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.r8", Popref_popi, Pushr8, InlineNone, Objmodel, Next, false, -1},
|
||||
{"ldelem.ref", Popref_popi, Pushref, InlineNone, Objmodel, Next, false, -1},
|
||||
{"stelem.i", Popref_popi_popi, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.i1", Popref_popi_popi, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.i2", Popref_popi_popi, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.i4", Popref_popi_popi, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.i8", Popref_popi_popi8, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.r4", Popref_popi_popr4, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.r8", Popref_popi_popr8, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"stelem.ref", Popref_popi_popref, Push0, InlineNone, Objmodel, Next, false, -3},
|
||||
{"ldelem", Popref_popi, Push1, InlineType, Objmodel, Next, false, -1},
|
||||
{"stelem", Popref_popi_pop1, Push0, InlineType, Objmodel, Next, false, 0},
|
||||
{"unbox.any", Popref, Push1, InlineType, Objmodel, Next, false, 0},
|
||||
{"conv.ovf.i1", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u1", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i2", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u2", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i4", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u4", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i8", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u8", Pop1, Pushi8, InlineNone, Primitive, Next, false, 0},
|
||||
{"refanyval", Pop1, Pushi, InlineType, Primitive, Next, false, 0},
|
||||
{"ckfinite", Pop1, Pushr8, InlineNone, Primitive, Next, false, 0},
|
||||
{"mkrefany", Popi, Push1, InlineType, Primitive, Next, false, 0},
|
||||
{"ldtoken", Pop0, Pushi, InlineTok, Primitive, Next, false, 1},
|
||||
{"conv.u2", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.u1", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.i", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.i", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"conv.ovf.u", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"add.ovf", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"add.ovf.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"mul.ovf", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"mul.ovf.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"sub.ovf", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"sub.ovf.un", Pop1_pop1, Push1, InlineNone, Primitive, Next, false, -1},
|
||||
{"endfinally", Pop0, Push0, InlineNone, Primitive, Return, true, 0},
|
||||
{"leave", Pop0, Push0, InlineBrTarget, Primitive, Branch, true, 0},
|
||||
{"leave.s", Pop0, Push0, ShortInlineBrTarget, Primitive, Branch, true, 0},
|
||||
{"stind.i", Popi_popi, Push0, InlineNone, Primitive, Next, false, -2},
|
||||
{"conv.u", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"arglist", Pop0, Pushi, InlineNone, Primitive, Next, false, 1},
|
||||
{"ceq", Pop1_pop1, Pushi, InlineNone, Primitive, Next, false, -1},
|
||||
{"cgt", Pop1_pop1, Pushi, InlineNone, Primitive, Next, false, -1},
|
||||
{"cgt.un", Pop1_pop1, Pushi, InlineNone, Primitive, Next, false, -1},
|
||||
{"clt", Pop1_pop1, Pushi, InlineNone, Primitive, Next, false, -1},
|
||||
{"clt.un", Pop1_pop1, Pushi, InlineNone, Primitive, Next, false, -1},
|
||||
{"ldftn", Pop0, Pushi, InlineMethod, Primitive, Next, false, 1},
|
||||
{"ldvirtftn", Popref, Pushi, InlineMethod, Primitive, Next, false, 0},
|
||||
{"ldarg", Pop0, Push1, InlineVar, Primitive, Next, false, 1},
|
||||
{"ldarga", Pop0, Pushi, InlineVar, Primitive, Next, false, 1},
|
||||
{"starg", Pop1, Push0, InlineVar, Primitive, Next, false, -1},
|
||||
{"ldloc", Pop0, Push1, InlineVar, Primitive, Next, false, 1},
|
||||
{"ldloca", Pop0, Pushi, InlineVar, Primitive, Next, false, 1},
|
||||
{"stloc", Pop1, Push0, InlineVar, Primitive, Next, false, -1},
|
||||
{"localloc", Popi, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"endfilter", Popi, Push0, InlineNone, Primitive, Return, true, -1},
|
||||
{"unaligned.", Pop0, Push0, ShortInlineI, Prefix, Meta, false, 0},
|
||||
{"volatile.", Pop0, Push0, InlineNone, Prefix, Meta, false, 0},
|
||||
{"tail.", Pop0, Push0, InlineNone, Prefix, Meta, false, 0},
|
||||
{"initobj", Popi, Push0, InlineType, Objmodel, Next, false, -1},
|
||||
{"constrained.", Pop0, Push0, InlineType, Prefix, Meta, false, 0},
|
||||
{"cpblk", Popi_popi_popi, Push0, InlineNone, Primitive, Next, false, -3},
|
||||
{"initblk", Popi_popi_popi, Push0, InlineNone, Primitive, Next, false, -3},
|
||||
{"no.", Pop0, Push0, InlineNone, Prefix, Meta, false, 0},
|
||||
{"rethrow", Pop0, Push0, InlineNone, Objmodel, Throw, true, 0},
|
||||
{"sizeof", Pop0, Pushi, InlineType, Primitive, Next, false, 1},
|
||||
{"refanytype", Pop1, Pushi, InlineNone, Primitive, Next, false, 0},
|
||||
{"readonly.", Pop0, Push0, InlineNone, Prefix, Meta, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0},
|
||||
{"", Pop0, Push0, InlineNone, Primitive, Next, false, 0}
|
||||
};
|
||||
|
||||
class TokenReference;
|
||||
class ILCommand;
|
||||
|
||||
class ILVMCommand : public BaseVMCommand
|
||||
{
|
||||
public:
|
||||
explicit ILVMCommand(ILCommand *owner, ILCommandType command_type, uint64_t value, TokenReference *token_reference);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual void set_address(uint64_t address) { address_ = address; }
|
||||
virtual void Compile();
|
||||
ILCommandType command_type() const { return command_type_; }
|
||||
uint64_t value() const { return value_; }
|
||||
void set_value(uint64_t value) { value_ = value; }
|
||||
void set_dump(const Data &dump) { dump_ = dump; }
|
||||
bool is_data() const { return (command_type_ == icByte || command_type_ == icWord || command_type_ == icDword); }
|
||||
virtual bool is_end() const { return false; }
|
||||
virtual void WriteToFile(IArchitecture &file);
|
||||
virtual size_t dump_size() const { return dump_.size(); }
|
||||
TokenReference *token_reference() const { return token_reference_; }
|
||||
ILCommandType crypt_command() const { return crypt_command_; }
|
||||
OperandSize crypt_size() const { return crypt_size_; }
|
||||
uint64_t crypt_key() const { return crypt_key_; }
|
||||
ILVMCommand *link_command() const { return link_command_; }
|
||||
void set_token_reference(TokenReference *token_reference) { token_reference_ = token_reference; }
|
||||
void set_crypt_command(ILCommandType crypt_command, OperandSize crypt_size, uint64_t crypt_key) { crypt_command_ = crypt_command; crypt_size_ = crypt_size; crypt_key_ = crypt_key; }
|
||||
void set_link_command(ILVMCommand *command) { link_command_ = command; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
ILCommandType command_type_;
|
||||
uint64_t value_;
|
||||
Data dump_;
|
||||
TokenReference *token_reference_;
|
||||
ILCommandType crypt_command_;
|
||||
OperandSize crypt_size_;
|
||||
uint64_t crypt_key_;
|
||||
ILVMCommand *link_command_;
|
||||
};
|
||||
|
||||
class ILCommand: public BaseCommand
|
||||
{
|
||||
public:
|
||||
explicit ILCommand(IFunction *owner, OperandSize size, ILCommandType type, uint64_t operand_value, IFixup *fixup = NULL);
|
||||
explicit ILCommand(IFunction *owner, OperandSize size, uint64_t address = 0);
|
||||
explicit ILCommand(IFunction *owner, OperandSize size, const std::string &value);
|
||||
explicit ILCommand(IFunction *owner, OperandSize size, const Data &value);
|
||||
explicit ILCommand(IFunction *owner, const ILCommand &source);
|
||||
void Init(ILCommandType type, uint64_t operand_value = 0, TokenReference *token_reference = NULL);
|
||||
virtual void clear();
|
||||
ILVMCommand *item(size_t index) const { return reinterpret_cast<ILVMCommand *>(BaseCommand::item(index)); }
|
||||
virtual uint64_t ext_vm_address() const { return (ext_vm_entry_) ? ext_vm_entry_->address() : vm_address(); }
|
||||
virtual ISEHandler *seh_handler() const;
|
||||
virtual void set_seh_handler(ISEHandler *handler);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual CommandType type() const { return type_; }
|
||||
virtual std::string text() const;
|
||||
virtual uint32_t section_options() const { return section_options_; }
|
||||
virtual void include_section_option(SectionOption option) { section_options_ |= option; }
|
||||
virtual void exclude_section_option(SectionOption option) { section_options_ &= ~option; }
|
||||
virtual size_t original_dump_size() const { return (original_dump_size_) ? original_dump_size_ : dump_size(); }
|
||||
virtual void CompileToNative();
|
||||
virtual void CompileLink(const CompileContext &ctx);
|
||||
virtual void PrepareLink(const CompileContext &ctx);
|
||||
virtual void set_operand_value(size_t operand_index, uint64_t value);
|
||||
virtual void set_link_value(size_t link_index, uint64_t value);
|
||||
virtual void set_jmp_value(size_t link_index, uint64_t value) {};
|
||||
virtual void set_address(uint64_t address);
|
||||
void set_operand_fixup(IFixup *fixup);
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
virtual ILCommand *Clone(IFunction *owner) const;
|
||||
virtual bool Merge(ICommand *command);
|
||||
void InitUnknown();
|
||||
void InitComment(const std::string &comment);
|
||||
virtual bool is_data() const;
|
||||
virtual bool is_end() const;
|
||||
bool is_prefix() const;
|
||||
virtual std::string display_address() const;
|
||||
virtual std::string dump_str() const;
|
||||
OperandSize size() const { return size_; }
|
||||
virtual CommentInfo comment();
|
||||
size_t ReadFromFile(IArchitecture & file);
|
||||
void WriteToFile(IArchitecture &file);
|
||||
uint64_t operand_value() const { return operand_value_; }
|
||||
size_t operand_pos() const { return operand_pos_; }
|
||||
uint64_t ReadValueFromFile(IArchitecture &file, OperandSize value_size, bool is_token = false);
|
||||
void ReadString(IArchitecture &file, size_t len);
|
||||
void ReadCaseCommand(IArchitecture &file);
|
||||
TokenReference *token_reference() const { return token_reference_; }
|
||||
void set_token_reference(TokenReference *token_reference) { token_reference_ = token_reference; }
|
||||
void CompileToVM(const CompileContext &ctx);
|
||||
ILVMCommand *AddVMCommand(const CompileContext &ctx, ILCommandType command_type, uint64_t value, uint32_t options = 0, TokenReference *token_reference = NULL, ILCommand *to_command = NULL);
|
||||
void AddExtSection(const CompileContext &ctx);
|
||||
void set_param(uint32_t param) { param_ = param; }
|
||||
int GetStackLevel(size_t *pop_ref = NULL) const;
|
||||
private:
|
||||
void AddCmpSection(const CompileContext &ctx, ILCommandType jmp_command);
|
||||
void AddJmpWithFlagSection(const CompileContext &ctx, bool is_true);
|
||||
void AddCryptorSection(const CompileContext &ctx, ValueCryptor *cryptor, bool is_decrypt);
|
||||
uint64_t address_;
|
||||
OperandSize size_;
|
||||
ILCommandType type_;
|
||||
uint64_t operand_value_;
|
||||
size_t original_dump_size_;
|
||||
uint32_t section_options_;
|
||||
size_t operand_pos_;
|
||||
TokenReference *token_reference_;
|
||||
std::vector<ILVMCommand *> vm_links_;
|
||||
InternalLinkList internal_links_;
|
||||
ILVMCommand *ext_vm_entry_;
|
||||
uint32_t param_;
|
||||
IFixup *fixup_;
|
||||
};
|
||||
|
||||
class ILFunction : public BaseFunction
|
||||
{
|
||||
public:
|
||||
explicit ILFunction(IFunctionList *owner, const FunctionName &name, CompilationType compilation_type, uint32_t compilation_options, bool need_compile, Folder *folder);
|
||||
explicit ILFunction(IFunctionList *owner = NULL);
|
||||
explicit ILFunction(IFunctionList *owner, OperandSize cpu_address_size, IFunction *parent = NULL);
|
||||
explicit ILFunction(IFunctionList *owner, const ILFunction &src);
|
||||
virtual ILFunction *Clone(IFunctionList *owner) const;
|
||||
ILCommand *item(size_t index) const { return reinterpret_cast<ILCommand *>(IFunction::item(index)); }
|
||||
virtual bool Compile(const CompileContext &ctx);
|
||||
virtual void AfterCompile(const CompileContext &ctx);
|
||||
virtual void CompileLinks(const CompileContext &ctx);
|
||||
virtual bool Prepare(const CompileContext &ctx);
|
||||
virtual void CompileInfo(const CompileContext &ctx);
|
||||
ILCommand *AddCommand(OperandSize value_size, uint64_t value);
|
||||
ILCommand *AddCommand(const std::string &value);
|
||||
ILCommand *AddCommand(const Data &value);
|
||||
ILCommand *AddCommand(ILCommandType type, uint64_t operand_value, IFixup *fixup = NULL);
|
||||
ILCommand *Add(uint64_t address);
|
||||
ILCommand *GetCommandByAddress(uint64_t address) const;
|
||||
ILCommand *GetCommandByNearAddress(uint64_t address) const;
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
virtual ILCommand *ParseCommand(IArchitecture &file, uint64_t address, bool dump_mode = false);
|
||||
void CreateBlocks();
|
||||
protected:
|
||||
virtual ILCommand *CreateCommand();
|
||||
virtual ILCommand *ParseString(IArchitecture &file, uint64_t address, size_t len);
|
||||
virtual void ParseBeginCommands(IArchitecture &file);
|
||||
virtual void ParseEndCommands(IArchitecture &file);
|
||||
virtual IFunction *CreateFunction(IFunction *parent) { return new ILFunction(NULL, cpu_address_size(), parent); }
|
||||
void CalcStack(std::map<ILCommand *, int> &stack_map);
|
||||
void Mutate(const CompileContext &ctx);
|
||||
void CompileToNative(const CompileContext &ctx);
|
||||
void CompileToVM(const CompileContext &ctx);
|
||||
};
|
||||
|
||||
class ILFileHelper : public IObject
|
||||
{
|
||||
public:
|
||||
explicit ILFileHelper();
|
||||
~ILFileHelper();
|
||||
void Parse(NETArchitecture &file);
|
||||
private:
|
||||
void AddString(NETArchitecture &file, uint32_t token, uint64_t reference);
|
||||
|
||||
std::vector<MapFunction *> string_list_;
|
||||
MapFunctionList *marker_name_list_;
|
||||
size_t marker_index_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ILFileHelper(const ILFileHelper &);
|
||||
ILFileHelper &operator =(const ILFileHelper &);
|
||||
};
|
||||
|
||||
class ILCommandBlock;
|
||||
class ILToken;
|
||||
class ILMethodDef;
|
||||
|
||||
class ILCommandNode : public IObject
|
||||
{
|
||||
public:
|
||||
ILCommandNode(ILCommandBlock *owner, ILCommand *command);
|
||||
~ILCommandNode();
|
||||
ILCommand *command() const { return command_; }
|
||||
std::vector<ILCommandNode*> stack() const { return stack_; }
|
||||
void set_stack(std::vector<ILCommandNode*> &stack) { stack_ = stack; }
|
||||
std::string token_name() const;
|
||||
private:
|
||||
ILCommandBlock *owner_;
|
||||
ILCommand *command_;
|
||||
std::vector<ILCommandNode*> stack_;
|
||||
};
|
||||
|
||||
class ILCommandBlock : public ObjectList<ILCommandNode>
|
||||
{
|
||||
public:
|
||||
ILCommandBlock();
|
||||
bool Parse(ILFunction &func);
|
||||
ILCommandNode *GetNodeByCommand(ILCommand *command) const;
|
||||
ILToken *GetTypeOf(ILCommandNode *node) const;
|
||||
ILToken *GetTypeFromStack(ILCommandNode *node) const;
|
||||
protected:
|
||||
void AddObject(ILCommandNode *node);
|
||||
private:
|
||||
ILCommandNode *Add(ILCommand *command);
|
||||
std::map<ILCommand *, ILCommandNode *> map_;
|
||||
ILMethodDef *method_;
|
||||
};
|
||||
|
||||
class NETLoader : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit NETLoader(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
virtual bool Prepare(const CompileContext &ctx);
|
||||
virtual bool Compile(const CompileContext &ctx);
|
||||
virtual size_t WriteToFile(IArchitecture &file);
|
||||
ILCommand *file_crc_entry() const { return file_crc_entry_; }
|
||||
uint32_t file_crc_size() const { return file_crc_size_; }
|
||||
ILCommand *file_crc_size_entry() const { return file_crc_size_entry_; }
|
||||
ILCommand *loader_crc_entry() const { return loader_crc_entry_; }
|
||||
uint32_t loader_crc_size() const { return loader_crc_size_; }
|
||||
ILCommand *loader_crc_size_entry() const { return loader_crc_size_entry_; }
|
||||
ILCommand *loader_crc_hash_entry() const { return loader_crc_hash_entry_; }
|
||||
ILCommand *import_entry() const { return import_entry_; }
|
||||
uint32_t import_size() const { return import_size_; }
|
||||
ILCommand *iat_entry() const { return iat_entry_; }
|
||||
uint32_t iat_size() const { return iat_size_; }
|
||||
ILCommand *pe_entry() const { return pe_entry_; }
|
||||
ILCommand *strong_name_signature_entry() const { return strong_name_signature_entry_; }
|
||||
ILCommand *vtable_fixups_entry() const { return vtable_fixups_entry_; }
|
||||
ILCommand *tls_entry() const { return tls_entry_; }
|
||||
uint32_t tls_size() const { return tls_size_; }
|
||||
private:
|
||||
void AddAVBuffer(const CompileContext &ctx);
|
||||
|
||||
struct ImportInfo {
|
||||
ILCommand *original_first_thunk;
|
||||
ILCommand *name;
|
||||
ILCommand *first_thunk;
|
||||
//IntelCommand *loader_name;
|
||||
};
|
||||
|
||||
struct ImportFunctionInfo {
|
||||
PEImportFunction *import_function;
|
||||
ILCommand *name;
|
||||
ILCommand *thunk;
|
||||
ILCommand *loader_name;
|
||||
ImportFunctionInfo(PEImportFunction *import_function_)
|
||||
: import_function(import_function_), name(NULL), thunk(NULL), loader_name(NULL) {}
|
||||
bool operator == (PEImportFunction *import_function_) const
|
||||
{
|
||||
return (import_function == import_function_);
|
||||
}
|
||||
};
|
||||
|
||||
struct LoaderInfo {
|
||||
ILCommand *data;
|
||||
size_t size;
|
||||
LoaderInfo(ILCommand *data_, size_t size_)
|
||||
: data(data_), size(size_) {}
|
||||
};
|
||||
|
||||
struct PackerInfo {
|
||||
PESegment *section;
|
||||
uint64_t address;
|
||||
size_t size;
|
||||
ILCommand *data;
|
||||
bool operator == (PESegment *section_) const
|
||||
{
|
||||
return (section == section_);
|
||||
}
|
||||
};
|
||||
|
||||
ILCommand *import_entry_;
|
||||
uint32_t import_size_;
|
||||
ILCommand *iat_entry_;
|
||||
uint32_t iat_size_;
|
||||
ILCommand *file_crc_entry_;
|
||||
ILCommand *file_crc_size_entry_;
|
||||
uint32_t file_crc_size_;
|
||||
ILCommand *loader_crc_entry_;
|
||||
ILCommand *loader_crc_size_entry_;
|
||||
ILCommand *loader_crc_hash_entry_;
|
||||
uint32_t loader_crc_size_;
|
||||
ILCommand *pe_entry_;
|
||||
ILCommand *strong_name_signature_entry_;
|
||||
ILCommand *vtable_fixups_entry_;
|
||||
ILCommand *tls_entry_;
|
||||
ILCommand *tls_call_back_entry_;
|
||||
uint32_t tls_size_;
|
||||
|
||||
};
|
||||
|
||||
class ILSDK : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit ILSDK(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
bool Init(const CompileContext &ctx);
|
||||
};
|
||||
|
||||
class ILCRCTable : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit ILCRCTable(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
bool Init(const CompileContext &ctx);
|
||||
size_t table_size() const { return (count() - 2) * OperandSizeToValue(osDWord); }
|
||||
ILCommand *table_entry() const { return item(0); }
|
||||
ILCommand *size_entry() const { return size_entry_; }
|
||||
ILCommand *hash_entry() const { return hash_entry_; }
|
||||
private:
|
||||
ILCommand *size_entry_;
|
||||
ILCommand *hash_entry_;
|
||||
};
|
||||
|
||||
class ILRuntimeData : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit ILRuntimeData(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
bool Init(const CompileContext &ctx);
|
||||
virtual size_t WriteToFile(IArchitecture &file);
|
||||
private:
|
||||
struct CommandCompareHelper {
|
||||
bool operator () (const ILCommand *left, ILCommand *right) const;
|
||||
};
|
||||
|
||||
RC5Key rc5_key_;
|
||||
ILCommand *resources_entry_;
|
||||
uint32_t resources_size_;
|
||||
ILCommand *strings_entry_;
|
||||
uint32_t strings_size_;
|
||||
ILCommand *trial_hwid_entry_;
|
||||
uint32_t trial_hwid_size_;
|
||||
#ifdef ULTIMATE
|
||||
ILCommand *license_data_entry_;
|
||||
uint32_t license_data_size_;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ILRuntimeCRCTable : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit ILRuntimeCRCTable(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
virtual void clear();
|
||||
virtual bool Compile(const CompileContext &ctx);
|
||||
virtual size_t WriteToFile(IArchitecture &file);
|
||||
size_t region_count() const { return region_info_list_.size(); }
|
||||
private:
|
||||
struct RegionInfo {
|
||||
uint64_t address;
|
||||
uint32_t size;
|
||||
bool is_self_crc;
|
||||
|
||||
RegionInfo(uint64_t address_, uint32_t size_, bool is_self_crc_)
|
||||
: address(address_), size(size_), is_self_crc(is_self_crc_)
|
||||
{
|
||||
}
|
||||
};
|
||||
std::vector<RegionInfo> region_info_list_;
|
||||
ValueCryptor *cryptor_;
|
||||
};
|
||||
|
||||
class ILToken;
|
||||
|
||||
struct ImportDelegateInfo
|
||||
{
|
||||
ILToken *method;
|
||||
ILToken *invoke;
|
||||
uint32_t call_type;
|
||||
ImportDelegateInfo(ILToken *method_, ILToken *invoke_, uint32_t call_type_)
|
||||
: method(method_), invoke(invoke_), call_type(call_type_)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class ILImport : public ILFunction
|
||||
{
|
||||
public:
|
||||
explicit ILImport(IFunctionList *owner, OperandSize cpu_address_size);
|
||||
bool Init(const CompileContext &ctx);
|
||||
std::vector<ImportDelegateInfo> info_list() const { return info_list_; }
|
||||
private:
|
||||
std::vector<ImportDelegateInfo> info_list_;
|
||||
};
|
||||
|
||||
class ILVirtualMachineProcessor;
|
||||
|
||||
class ILFunctionList : public BaseFunctionList
|
||||
{
|
||||
public:
|
||||
explicit ILFunctionList(IArchitecture *owner);
|
||||
explicit ILFunctionList(IArchitecture *owner, const ILFunctionList &src);
|
||||
~ILFunctionList();
|
||||
ILFunction *item(size_t index) const;
|
||||
ILFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
virtual bool Prepare(const CompileContext &ctx);
|
||||
virtual bool Compile(const CompileContext &ctx);
|
||||
virtual void CompileLinks(const CompileContext &ctx);
|
||||
virtual void CompileInfo(const CompileContext &ctx);
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
virtual ILFunction *Add(const std::string &name, CompilationType compilation_type, uint32_t compilation_options, bool need_compile, Folder *folder);
|
||||
virtual ILFunctionList *Clone(IArchitecture *owner) const;
|
||||
virtual ILCRCTable *crc_table() const { return crc_table_; }
|
||||
virtual ValueCryptor *crc_cryptor() const { return crc_cryptor_; }
|
||||
ILImport *import() const { return import_; }
|
||||
ILRuntimeCRCTable *runtime_crc_table() const { return runtime_crc_table_; }
|
||||
virtual IFunction *CreateFunction(OperandSize cpu_address_size = osDefault);
|
||||
virtual bool GetRuntimeOptions() const { return true; }
|
||||
ILVirtualMachineProcessor *AddProcessor(OperandSize cpu_address_size);
|
||||
protected:
|
||||
ILSDK *AddSDK(OperandSize cpu_address_size);
|
||||
ILRuntimeData *AddRuntimeData(OperandSize cpu_address_size);
|
||||
ILCRCTable *AddCRCTable(OperandSize cpu_address_size);
|
||||
ILFunction *AddWatermark(OperandSize cpu_address_size, Watermark *watermark, int copy_count);
|
||||
ILRuntimeCRCTable *AddRuntimeCRCTable(OperandSize cpu_address_size);
|
||||
ILImport *AddImport(OperandSize cpu_address_size);
|
||||
|
||||
ValueCryptor *crc_cryptor_;
|
||||
ILCRCTable *crc_table_;
|
||||
ILRuntimeCRCTable *runtime_crc_table_;
|
||||
ILImport *import_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ILFunctionList(const ILFunctionList &);
|
||||
ILFunctionList &operator =(const ILFunctionList &);
|
||||
};
|
||||
|
||||
class ILVirtualMachineProcessor : public ILFunction
|
||||
{
|
||||
public:
|
||||
ILVirtualMachineProcessor(ILFunctionList *owner, OperandSize cpu_address_size);
|
||||
void InitCommands(const CompileContext &ctx);
|
||||
virtual void AfterCompile(const CompileContext &ctx);
|
||||
virtual void CompileLinks(const CompileContext &ctx);
|
||||
virtual void CompileInfo(const CompileContext &ctx);
|
||||
virtual size_t WriteToFile(IArchitecture &file);
|
||||
};
|
||||
|
||||
class ILVirtualMachineList : public IVirtualMachineList
|
||||
{
|
||||
public:
|
||||
virtual IVirtualMachineList * Clone() const;
|
||||
virtual void Prepare(const CompileContext &ctx);
|
||||
virtual IFunction *processor() const { return NULL; }
|
||||
};
|
||||
|
||||
class ILOpcodeList;
|
||||
class ILToken;
|
||||
|
||||
class ILOpcodeInfo : public IObject
|
||||
{
|
||||
public:
|
||||
ILOpcodeInfo(ILOpcodeList *owner, ILCommandType command_type, ILToken *entry);
|
||||
~ILOpcodeInfo();
|
||||
ILCommandType command_type() const { return command_type_; }
|
||||
ILToken *entry() const { return entry_; }
|
||||
uint8_t opcode() const { return opcode_; }
|
||||
void set_opcode(uint8_t opcode) { opcode_ = opcode; }
|
||||
uint64_t Key() const { return command_type_; }
|
||||
class circular_queue : public std::vector<ILOpcodeInfo *>
|
||||
{
|
||||
size_t position_;
|
||||
public:
|
||||
circular_queue() : std::vector<ILOpcodeInfo *>(), position_(0) {}
|
||||
ILOpcodeInfo *Next();
|
||||
};
|
||||
private:
|
||||
ILOpcodeList *owner_;
|
||||
ILCommandType command_type_;
|
||||
ILToken *entry_;
|
||||
uint8_t opcode_;
|
||||
};
|
||||
|
||||
class ILOpcodeList : public ObjectList<ILOpcodeInfo>
|
||||
{
|
||||
public:
|
||||
ILOpcodeList();
|
||||
ILOpcodeInfo *Add(ILCommandType command_type, ILToken *entry);
|
||||
ILOpcodeInfo *GetOpcodeInfo(ILCommandType command_type) const;
|
||||
};
|
||||
|
||||
class ILMethodDef;
|
||||
|
||||
class ILVirtualMachine : public BaseVirtualMachine
|
||||
{
|
||||
public:
|
||||
ILVirtualMachine(ILVirtualMachineList *owner, uint8_t id, ILVirtualMachineProcessor *processor);
|
||||
void Init(const CompileContext &ctx);
|
||||
virtual ByteList *registr_order() { return NULL; }
|
||||
virtual bool backward_direction() const { return false; }
|
||||
virtual ILFunction *processor() const { return processor_; }
|
||||
ILMethodDef *ctor() const { return ctor_; }
|
||||
ILMethodDef *invoke() const { return invoke_; }
|
||||
void CompileCommand(ILVMCommand &vm_command);
|
||||
private:
|
||||
ILOpcodeInfo *GetOpcode(ILCommandType command_type);
|
||||
ILVirtualMachineProcessor *processor_;
|
||||
ILMethodDef *ctor_;
|
||||
ILMethodDef *invoke_;
|
||||
ILOpcodeList opcode_list_;
|
||||
std::unordered_map<uint64_t, ILOpcodeInfo::circular_queue> opcode_stack_;
|
||||
};
|
||||
|
||||
#endif
|
||||
+304
@@ -0,0 +1,304 @@
|
||||
#include "objects.h"
|
||||
#include "inifile.h"
|
||||
#include "osutils.h"
|
||||
#include "lang.h"
|
||||
|
||||
SettingsFile &settings_file()
|
||||
{
|
||||
static SettingsFile file_;
|
||||
return file_;
|
||||
}
|
||||
|
||||
long StrToIntDef(const char *str, long default_value)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
if (len == 0)
|
||||
return default_value;
|
||||
|
||||
char *end;
|
||||
long res = strtol(str, &end, 0);
|
||||
if (end != str + len)
|
||||
return default_value;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
uint64_t StrToInt64Def(const char *str, uint64_t default_value)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
if (len == 0)
|
||||
return default_value;
|
||||
|
||||
char *end;
|
||||
uint64_t res = _strtoi64(str, &end, 0);
|
||||
if (end != str + len)
|
||||
return default_value;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* BaseIniFile
|
||||
*/
|
||||
|
||||
int BaseIniFile::ReadInt(const char *section, const char *name, int default_value) const
|
||||
{
|
||||
std::string str = ReadString(section, name);
|
||||
return StrToIntDef(str.c_str(), default_value);
|
||||
}
|
||||
|
||||
uint64_t BaseIniFile::ReadInt64(const char *section, const char *name, uint64_t default_value) const
|
||||
{
|
||||
std::string str = ReadString(section, name);
|
||||
return StrToInt64Def(str.c_str(), default_value);
|
||||
}
|
||||
|
||||
void BaseIniFile::WriteInt(const char *section, const char *name, int value)
|
||||
{
|
||||
WriteString(section, name, string_format("%d", value).c_str());
|
||||
}
|
||||
|
||||
bool BaseIniFile::ReadBool(const char *section, const char *name, bool default_value) const
|
||||
{
|
||||
return ReadInt(section, name, default_value ? 1 : 0) != 0;
|
||||
}
|
||||
|
||||
void BaseIniFile::WriteBool(const char *section, const char *name, bool value)
|
||||
{
|
||||
WriteString(section, name, value ? "1" : "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* IniFile
|
||||
*/
|
||||
|
||||
IniFile::IniFile(const char *file_name)
|
||||
: BaseIniFile(), file_name_(file_name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string IniFile::ReadString(const char *section, const char *name, const char *default_value) const
|
||||
{
|
||||
return os::ReadIniString(section, name, default_value, file_name_.c_str());
|
||||
}
|
||||
|
||||
void IniFile::WriteString(const char *section, const char *name, const char *value)
|
||||
{
|
||||
if (!os::WriteIniString(section, name, value, file_name_.c_str()))
|
||||
throw std::runtime_error(string_format("Unable to write to %s", file_name_.c_str()));
|
||||
}
|
||||
|
||||
bool IniFile::DeleteKey(const char *section, const char *name)
|
||||
{
|
||||
return os::WriteIniString(section, name, NULL, file_name_.c_str());
|
||||
}
|
||||
|
||||
std::vector<std::string> IniFile::ReadSection(const char *section, const char *name_mask) const
|
||||
{
|
||||
std::vector<std::string> res;
|
||||
std::string buffer = os::ReadIniString(section, NULL, NULL, file_name_.c_str());
|
||||
const char *p = buffer.c_str();
|
||||
while (*p) {
|
||||
std::string str = p;
|
||||
if (!name_mask || str.find(name_mask) == 0)
|
||||
res.push_back(str);
|
||||
p += str.size() + 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void IniFile::EraseSection(const char *section)
|
||||
{
|
||||
os::WriteIniString(section, NULL, NULL, file_name_.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* SettingsFile
|
||||
*/
|
||||
|
||||
#ifdef VMP_GNU
|
||||
int GlobalLocker::depth;
|
||||
#endif
|
||||
|
||||
SettingsFile::SettingsFile()
|
||||
: IObject(), document_(NULL), last_write_time_(0), watermarks_node_created_(false), auto_save_project_(false)
|
||||
{
|
||||
file_name_ = os::CombineThisAppDataDirectory("VMProtect.dat");
|
||||
if (!os::FileExists(file_name_.c_str()))
|
||||
os::PathCreate(os::ExtractFilePath(file_name_.c_str()).c_str());
|
||||
|
||||
language_manager_ = new LanguageManager();
|
||||
language_ = os::GetCurrentLocale();
|
||||
if (!language_manager_->GetLanguageById(language_)) {
|
||||
// remove country code
|
||||
size_t i = language_.find('_');
|
||||
if (i != std::string::npos)
|
||||
language_ = language_.substr(0, i);
|
||||
}
|
||||
|
||||
document_ = new TiXmlDocument();
|
||||
Open();
|
||||
|
||||
if (settings_node_) {
|
||||
settings_node_->QueryStringAttribute("Language", &language_);
|
||||
settings_node_->QueryBoolAttribute("AutoSaveProject", &auto_save_project_);
|
||||
}
|
||||
|
||||
if (!language_manager_->GetLanguageById(language_))
|
||||
language_ = language_manager_->default_language();
|
||||
language_manager_->set_language(language_);
|
||||
}
|
||||
|
||||
SettingsFile::~SettingsFile()
|
||||
{
|
||||
delete document_;
|
||||
delete language_manager_;
|
||||
}
|
||||
|
||||
std::vector<std::string> SettingsFile::project_list() const
|
||||
{
|
||||
std::vector<std::string> res;
|
||||
if (settings_node_) {
|
||||
TiXmlElement *node = settings_node_->FirstChildElement("Projects");
|
||||
if (node) {
|
||||
node = node->FirstChildElement("Project");
|
||||
while (node) {
|
||||
const char *prj = node->GetText();
|
||||
if (prj) res.push_back(prj);
|
||||
node = node->NextSiblingElement(node->Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void SettingsFile::set_project_list(const std::vector<std::string> &project_list)
|
||||
{
|
||||
GlobalLocker locker;
|
||||
Open();
|
||||
if (!settings_node_)
|
||||
return;
|
||||
|
||||
TiXmlElement *projects_node = settings_node_->FirstChildElement("Projects");
|
||||
if (!projects_node) {
|
||||
projects_node = new TiXmlElement("Projects");
|
||||
settings_node_->LinkEndChild(projects_node);
|
||||
} else {
|
||||
projects_node->Clear();
|
||||
}
|
||||
for (size_t i = 0; i < project_list.size(); i++) {
|
||||
TiXmlElement *node = new TiXmlElement("Project");
|
||||
projects_node->LinkEndChild(node);
|
||||
node->LinkEndChild(new TiXmlText(project_list[i]));
|
||||
}
|
||||
Save();
|
||||
}
|
||||
|
||||
void SettingsFile::set_language(const std::string &language)
|
||||
{
|
||||
language_ = language;
|
||||
language_manager_->set_language(language_);
|
||||
|
||||
GlobalLocker locker;
|
||||
Open();
|
||||
if (!settings_node_)
|
||||
return;
|
||||
|
||||
settings_node_->SetAttribute("Language", language_);
|
||||
Save();
|
||||
}
|
||||
|
||||
void SettingsFile::set_auto_save_project(bool auto_save_project)
|
||||
{
|
||||
auto_save_project_ = auto_save_project;
|
||||
|
||||
GlobalLocker locker;
|
||||
Open();
|
||||
if (!settings_node_)
|
||||
return;
|
||||
|
||||
settings_node_->SetAttribute("AutoSaveProject", auto_save_project_);
|
||||
Save();
|
||||
}
|
||||
|
||||
size_t SettingsFile::inc_watermark_id()
|
||||
{
|
||||
GlobalLocker locker;
|
||||
Open();
|
||||
if (!watermarks_node_)
|
||||
return -1;
|
||||
|
||||
unsigned int u;
|
||||
u = 0;
|
||||
watermarks_node_->QueryUnsignedAttribute("Id", &u);
|
||||
watermarks_node_->SetAttribute("Id", u + 1);
|
||||
Save();
|
||||
return u;
|
||||
}
|
||||
|
||||
TiXmlElement *SettingsFile::watermark_node(size_t id, bool can_create)
|
||||
{
|
||||
Open();
|
||||
if (!watermarks_node_)
|
||||
return NULL;
|
||||
|
||||
TiXmlElement *node = watermarks_node_->FirstChildElement("Watermark");
|
||||
while (node) {
|
||||
unsigned int u;
|
||||
u = 0;
|
||||
node->QueryUnsignedAttribute("Id", &u);
|
||||
if (id == u)
|
||||
return node;
|
||||
node = node->NextSiblingElement(node->Value());
|
||||
}
|
||||
if (can_create) {
|
||||
node = new TiXmlElement("Watermark");
|
||||
watermarks_node_->LinkEndChild(node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
void SettingsFile::Open()
|
||||
{
|
||||
GlobalLocker locker;
|
||||
uint64_t cur_write_time = os::GetLastWriteTime(file_name_.c_str());
|
||||
if (cur_write_time && last_write_time_ == cur_write_time)
|
||||
return;
|
||||
|
||||
if (!document_->LoadFile(file_name_.c_str())) {
|
||||
document_->Clear();
|
||||
document_->LinkEndChild(new TiXmlDeclaration("1.0", "UTF-8", ""));
|
||||
}
|
||||
|
||||
root_node_ = document_->FirstChildElement("Document");
|
||||
if (!root_node_) {
|
||||
root_node_ = new TiXmlElement("Document");
|
||||
document_->LinkEndChild(root_node_);
|
||||
}
|
||||
|
||||
settings_node_ = root_node_->FirstChildElement("Settings");
|
||||
if (!settings_node_) {
|
||||
settings_node_ = new TiXmlElement("Settings");
|
||||
root_node_->LinkEndChild(settings_node_);
|
||||
}
|
||||
|
||||
watermarks_node_ = root_node_->FirstChildElement("Watermarks");
|
||||
if (!watermarks_node_) {
|
||||
watermarks_node_ = new TiXmlElement("Watermarks");
|
||||
root_node_->LinkEndChild(watermarks_node_);
|
||||
watermarks_node_created_ = true;
|
||||
} else {
|
||||
watermarks_node_created_ = false;
|
||||
}
|
||||
|
||||
last_write_time_ = os::GetLastWriteTime(file_name_.c_str());
|
||||
}
|
||||
|
||||
void SettingsFile::Save()
|
||||
{
|
||||
GlobalLocker locker;
|
||||
document_->SaveFile(file_name_.c_str());
|
||||
|
||||
last_write_time_ = os::GetLastWriteTime(file_name_.c_str());
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
#ifndef INIFILE_H
|
||||
#define INIFILE_H
|
||||
|
||||
long StrToIntDef(const char *str, long default_value);
|
||||
uint64_t StrToInt64Def(const char *str, uint64_t default_value);
|
||||
|
||||
class IIniFile : public IObject
|
||||
{
|
||||
public:
|
||||
virtual std::string ReadString(const char *section, const char *name, const char *default_value = NULL) const = 0;
|
||||
virtual void WriteString(const char *section, const char *name, const char *value) = 0;
|
||||
virtual int ReadInt(const char *section, const char *name, int default_value = 0) const = 0;
|
||||
virtual uint64_t ReadInt64(const char *section, const char *name, uint64_t default_value = 0) const = 0;
|
||||
virtual void WriteInt(const char *section, const char *name, int value) = 0;
|
||||
virtual bool ReadBool(const char *section, const char *name, bool default_value = false) const = 0;
|
||||
virtual void WriteBool(const char *section, const char *name, bool value) = 0;
|
||||
virtual bool DeleteKey(const char *section, const char *name) = 0;
|
||||
};
|
||||
|
||||
class BaseIniFile : public IIniFile
|
||||
{
|
||||
public:
|
||||
virtual int ReadInt(const char *section, const char *name, int default_value = 0) const;
|
||||
virtual uint64_t ReadInt64(const char *section, const char *name, uint64_t default_value = 0) const;
|
||||
virtual void WriteInt(const char *section, const char *name, int value);
|
||||
virtual bool ReadBool(const char *section, const char *name, bool default_value = false) const;
|
||||
virtual void WriteBool(const char *section, const char *name, bool value);
|
||||
};
|
||||
|
||||
class IniFile : public BaseIniFile
|
||||
{
|
||||
public:
|
||||
IniFile(const char *file_name);
|
||||
virtual std::string ReadString(const char *section, const char *name, const char *default_value = NULL) const;
|
||||
virtual void WriteString(const char *section, const char *name, const char *value);
|
||||
virtual bool DeleteKey(const char *section, const char *name);
|
||||
std::vector<std::string> ReadSection(const char *section, const char *name_mask = "") const;
|
||||
void EraseSection(const char *section);
|
||||
std::string file_name() const { return file_name_; }
|
||||
private:
|
||||
std::string file_name_;
|
||||
};
|
||||
|
||||
class LanguageManager;
|
||||
|
||||
// âðåìåííûé êîñòûëü äëÿ ïðîâåðêè ìíîãîïðîöåññîðíîé ñáîðêè
|
||||
#ifdef VMP_GNU
|
||||
#define MUTEX_FILE "/tmp/VMProtect.dat.mutex"
|
||||
#endif
|
||||
|
||||
struct GlobalLocker
|
||||
{
|
||||
#ifdef VMP_GNU
|
||||
int mutex_;
|
||||
static int depth;
|
||||
#else
|
||||
HANDLE mutex_;
|
||||
#endif
|
||||
|
||||
GlobalLocker()
|
||||
{
|
||||
#ifdef VMP_GNU
|
||||
// ìíîãîïîòî÷íîé çàùèòû çäåñü íåò, òîëüêî ìíîãîïðîöåññíàÿ è îò ðåêóðñèè
|
||||
++depth;
|
||||
if (depth == 1)
|
||||
{
|
||||
mutex_ = open(MUTEX_FILE, O_CREAT | O_EXLOCK, 0666);
|
||||
}
|
||||
#else
|
||||
static HANDLE mutex = CreateMutexA(NULL, FALSE, "Global\\VMProtect.dat");
|
||||
mutex_ = mutex;
|
||||
WaitForSingleObject(mutex_, 10000);
|
||||
#endif
|
||||
}
|
||||
|
||||
~GlobalLocker()
|
||||
{
|
||||
#ifdef VMP_GNU
|
||||
if (depth == 1)
|
||||
{
|
||||
if(mutex_ >= 0)
|
||||
close(mutex_);
|
||||
unlink(MUTEX_FILE);
|
||||
}
|
||||
--depth;
|
||||
#else
|
||||
ReleaseMutex(mutex_);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class SettingsFile : IObject
|
||||
{
|
||||
public:
|
||||
explicit SettingsFile();
|
||||
~SettingsFile();
|
||||
std::vector<std::string> project_list() const;
|
||||
void set_project_list(const std::vector<std::string> &project_list);
|
||||
std::string language() const { return language_; }
|
||||
void set_language(const std::string &language);
|
||||
TiXmlElement *watermarks_node() const { return watermarks_node_; }
|
||||
TiXmlElement *root_node() const { return settings_node_; }
|
||||
size_t inc_watermark_id();
|
||||
TiXmlElement *watermark_node(size_t id, bool can_create = false);
|
||||
LanguageManager *language_manager() const { return language_manager_; }
|
||||
void Save();
|
||||
bool watermarks_node_created() const { return watermarks_node_created_; }
|
||||
bool auto_save_project() const { return auto_save_project_; };
|
||||
void set_auto_save_project(bool auto_save_project);
|
||||
private:
|
||||
void Open();
|
||||
std::string file_name_;
|
||||
TiXmlDocument *document_;
|
||||
TiXmlElement *root_node_;
|
||||
TiXmlElement *watermarks_node_;
|
||||
TiXmlElement *settings_node_;
|
||||
uint64_t last_write_time_;
|
||||
std::string language_;
|
||||
LanguageManager *language_manager_;
|
||||
bool watermarks_node_created_;
|
||||
bool auto_save_project_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
SettingsFile(const SettingsFile &);
|
||||
SettingsFile &operator =(const SettingsFile &);
|
||||
};
|
||||
|
||||
SettingsFile &settings_file();
|
||||
|
||||
#endif
|
||||
+1570
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
SOURCES := \
|
||||
$(addprefix ../../third-party/tinyxml/, \
|
||||
tinyxml.cpp \
|
||||
tinyxmlparser.cpp \
|
||||
tinyxmlerr.cpp) \
|
||||
$(addprefix ../../third-party/scintilla/, \
|
||||
XPM.cxx \
|
||||
WordList.cxx \
|
||||
ViewStyle.cxx \
|
||||
UniConversion.cxx \
|
||||
StyleContext.cxx \
|
||||
Style.cxx \
|
||||
Selection.cxx \
|
||||
ScintillaBase.cxx \
|
||||
RunStyles.cxx \
|
||||
RESearch.cxx \
|
||||
PropSetSimple.cxx \
|
||||
PositionCache.cxx \
|
||||
PerLine.cxx \
|
||||
LineMarker.cxx \
|
||||
LexerSimple.cxx \
|
||||
LexerModule.cxx \
|
||||
LexerBase.cxx \
|
||||
LexLua.cxx \
|
||||
KeyMap.cxx \
|
||||
Indicator.cxx \
|
||||
ExternalLexer.cxx \
|
||||
Editor.cxx \
|
||||
Document.cxx \
|
||||
Decoration.cxx \
|
||||
ContractionState.cxx \
|
||||
CharacterSet.cxx \
|
||||
CharClassify.cxx \
|
||||
CellBuffer.cxx \
|
||||
Catalogue.cxx \
|
||||
CaseFolder.cxx \
|
||||
CaseConvert.cxx \
|
||||
CallTip.cxx \
|
||||
AutoComplete.cxx \
|
||||
Accessor.cxx)
|
||||
|
||||
SOURCES_C := \
|
||||
$(addprefix ../../third-party/demangle/, \
|
||||
cp-demangle.c \
|
||||
undname.c \
|
||||
unmangle.c) \
|
||||
$(addprefix ../../third-party/lzma/, \
|
||||
Alloc.c \
|
||||
LzFind.c \
|
||||
LzmaEnc.c) \
|
||||
$(addprefix ../../third-party/lua/, \
|
||||
lapi.c \
|
||||
lauxlib.c \
|
||||
lstate.c \
|
||||
ldebug.c \
|
||||
lzio.c \
|
||||
llex.c \
|
||||
lctype.c \
|
||||
lvm.c \
|
||||
ldump.c \
|
||||
ltm.c \
|
||||
lstring.c \
|
||||
lundump.c \
|
||||
lobject.c \
|
||||
lparser.c \
|
||||
lcode.c \
|
||||
lmem.c \
|
||||
ltable.c \
|
||||
ldo.c \
|
||||
lgc.c \
|
||||
lfunc.c \
|
||||
linit.c \
|
||||
lopcodes.c \
|
||||
loadlib.c \
|
||||
ltablib.c \
|
||||
lstrlib.c \
|
||||
liolib.c \
|
||||
lmathlib.c \
|
||||
loslib.c \
|
||||
lbaselib.c \
|
||||
lbitlib.c \
|
||||
lcorolib.c \
|
||||
ldblib.c)
|
||||
|
||||
PROJECT := invariant_core
|
||||
TARGET := $(PROJECT).a
|
||||
BIN_DIR := ../../bin/$(ARCH_DIR)
|
||||
TMP_DIR := ../../tmp/lin/$(PROJECT)/$(ARCH_DIR)/ICORE
|
||||
DEFINES := -DSCI_NAMESPACE -DTIXML_USE_STL -DSPV_LIBRARY -DSCI_LEXER -DSPV_LIBRARY -D_7ZIP_ST -DLUA_USE_MKSTEMP -DFFI_BUILDING -DLUA_USE_POSIX
|
||||
CFLAGS := -Wno-deprecated-declarations
|
||||
LFLAGS :=
|
||||
LIBS :=
|
||||
OBJCOMP :=
|
||||
|
||||
TMP_DIR_CORE_INVAR := $(TMP_DIR)/CORE_INVAR
|
||||
TMP_DIR_CORE_INVAR_C := $(TMP_DIR)/CORE_INVAR_C
|
||||
|
||||
OBJECTS_CORE_INVAR := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR)/, $(SOURCES)))
|
||||
OBJECTS_CORE_INVAR_C := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR_C)/, $(SOURCES_C)))
|
||||
|
||||
OBJECTS := $(OBJECTS_CORE_INVAR) $(OBJECTS_CORE_INVAR_C)
|
||||
|
||||
PCH_DIR := $(TMP_DIR_CORE_INVAR)
|
||||
|
||||
PCH_C := $(TMP_DIR_CORE_INVAR_C)/precompiled_c.h.gch
|
||||
|
||||
$(PCH_C): precompiled_c.h $(TMP_DIR_CORE_INVAR_C)/.sentinel
|
||||
$(CC) $(CFLAGS) $(INCFLAGS) -x c-header precompiled_c.c -o $(PCH_C)
|
||||
|
||||
include ../../lin_common.mak
|
||||
|
||||
clean:
|
||||
-$(DEL_FILE) $(abspath $(OBJECTS))
|
||||
-$(DEL_FILE) $(PCH_CPP) $(PCH_C)
|
||||
-$(DEL_FILE) $(BIN_TARGET)
|
||||
|
||||
$(TMP_DIR_CORE_INVAR)/%.o: % $(PCH_CPP) $(TMP_DIR_CORE_INVAR)/%/../.sentinel
|
||||
$(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(TMP_DIR_CORE_INVAR_C)/%.o: % $(PCH_C) $(TMP_DIR_CORE_INVAR_C)/%/../.sentinel
|
||||
$(CC) -c -include-pch $(PCH_C) $(CFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(OBJCOMP)
|
||||
ar $(SLIBFLAGS) $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := i386-linux-gnu
|
||||
ARCH_DIR := 32
|
||||
include lin_invariant_core.mak
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := x86_64-linux-gnu
|
||||
ARCH_DIR := 64
|
||||
include lin_invariant_core.mak
|
||||
@@ -0,0 +1,124 @@
|
||||
SOURCES := \
|
||||
$(addprefix ../../third-party/tinyxml/, \
|
||||
tinyxml.cpp \
|
||||
tinyxmlparser.cpp \
|
||||
tinyxmlerr.cpp) \
|
||||
$(addprefix ../../third-party/scintilla/, \
|
||||
XPM.cxx \
|
||||
WordList.cxx \
|
||||
ViewStyle.cxx \
|
||||
UniConversion.cxx \
|
||||
StyleContext.cxx \
|
||||
Style.cxx \
|
||||
Selection.cxx \
|
||||
ScintillaBase.cxx \
|
||||
RunStyles.cxx \
|
||||
RESearch.cxx \
|
||||
PropSetSimple.cxx \
|
||||
PositionCache.cxx \
|
||||
PerLine.cxx \
|
||||
LineMarker.cxx \
|
||||
LexerSimple.cxx \
|
||||
LexerModule.cxx \
|
||||
LexerBase.cxx \
|
||||
LexLua.cxx \
|
||||
KeyMap.cxx \
|
||||
Indicator.cxx \
|
||||
ExternalLexer.cxx \
|
||||
Editor.cxx \
|
||||
Document.cxx \
|
||||
Decoration.cxx \
|
||||
ContractionState.cxx \
|
||||
CharacterSet.cxx \
|
||||
CharClassify.cxx \
|
||||
CellBuffer.cxx \
|
||||
Catalogue.cxx \
|
||||
CaseFolder.cxx \
|
||||
CaseConvert.cxx \
|
||||
CallTip.cxx \
|
||||
AutoComplete.cxx \
|
||||
Accessor.cxx)
|
||||
|
||||
SOURCES_C := \
|
||||
$(addprefix ../../third-party/demangle/, \
|
||||
cp-demangle.c \
|
||||
undname.c \
|
||||
unmangle.c) \
|
||||
$(addprefix ../../third-party/lzma/, \
|
||||
Alloc.c \
|
||||
LzFind.c \
|
||||
LzmaEnc.c) \
|
||||
$(addprefix ../../third-party/lua/, \
|
||||
lapi.c \
|
||||
lauxlib.c \
|
||||
lstate.c \
|
||||
ldebug.c \
|
||||
lzio.c \
|
||||
llex.c \
|
||||
lctype.c \
|
||||
lvm.c \
|
||||
ldump.c \
|
||||
ltm.c \
|
||||
lstring.c \
|
||||
lundump.c \
|
||||
lobject.c \
|
||||
lparser.c \
|
||||
lcode.c \
|
||||
lmem.c \
|
||||
ltable.c \
|
||||
ldo.c \
|
||||
lgc.c \
|
||||
lfunc.c \
|
||||
linit.c \
|
||||
lopcodes.c \
|
||||
loadlib.c \
|
||||
ltablib.c \
|
||||
lstrlib.c \
|
||||
liolib.c \
|
||||
lmathlib.c \
|
||||
loslib.c \
|
||||
lbaselib.c \
|
||||
lbitlib.c \
|
||||
lcorolib.c \
|
||||
ldblib.c)
|
||||
|
||||
PROJECT := invariant_core
|
||||
TARGET := $(PROJECT).a
|
||||
BIN_DIR := ../../bin/$(ARCH_DIR)
|
||||
TMP_DIR := ../../tmp/mac/$(PROJECT)/$(ARCH_DIR)/ICORE
|
||||
DEFINES := -DSCI_NAMESPACE -DTIXML_USE_STL -DSPV_LIBRARY -DSCI_LEXER -DSPV_LIBRARY -D_7ZIP_ST -DFFI_BUILDING -DLUA_USE_POSIX
|
||||
CFLAGS := -Wno-deprecated-declarations
|
||||
LFLAGS :=
|
||||
LIBS :=
|
||||
OBJCOMP :=
|
||||
|
||||
TMP_DIR_CORE_INVAR := $(TMP_DIR)/CORE_INVAR
|
||||
TMP_DIR_CORE_INVAR_C := $(TMP_DIR)/CORE_INVAR_C
|
||||
|
||||
OBJECTS_CORE_INVAR := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR)/, $(SOURCES)))
|
||||
OBJECTS_CORE_INVAR_C := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR_C)/, $(SOURCES_C)))
|
||||
|
||||
OBJECTS := $(OBJECTS_CORE_INVAR) $(OBJECTS_CORE_INVAR_C)
|
||||
|
||||
PCH_DIR := $(TMP_DIR_CORE_INVAR)
|
||||
|
||||
PCH_C := $(TMP_DIR_CORE_INVAR_C)/precompiled_c.h.gch
|
||||
|
||||
$(PCH_C): precompiled_c.h $(TMP_DIR_CORE_INVAR_C)/.sentinel
|
||||
$(CC) $(CFLAGS) $(INCFLAGS) -x c-header precompiled_c.c -o $(PCH_C)
|
||||
|
||||
include ../../mac_common.mak
|
||||
|
||||
clean:
|
||||
-$(DEL_FILE) $(abspath $(OBJECTS))
|
||||
-$(DEL_FILE) $(PCH_CPP) $(PCH_C)
|
||||
-$(DEL_FILE) $(BIN_TARGET)
|
||||
|
||||
$(TMP_DIR_CORE_INVAR)/%.o: % $(PCH_CPP) $(TMP_DIR_CORE_INVAR)/%/../.sentinel
|
||||
$(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(TMP_DIR_CORE_INVAR_C)/%.o: % $(PCH_C) $(TMP_DIR_CORE_INVAR_C)/%/../.sentinel
|
||||
$(CC) -c -include-pch $(PCH_C) $(CFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(OBJCOMP)
|
||||
libtool $(SLIBFLAGS) -o $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := i386
|
||||
ARCH_DIR := 32
|
||||
include mac_invariant_core.mak
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := x86_64
|
||||
ARCH_DIR := 64
|
||||
include mac_invariant_core.mak
|
||||
@@ -0,0 +1,92 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#ifdef CHECKED
|
||||
const int PATTERN = 0xAA;
|
||||
void *mynew(size_t s)
|
||||
{
|
||||
uint8_t *ptr = (uint8_t *)malloc(s + 8);
|
||||
if(ptr)
|
||||
{
|
||||
memset(ptr, PATTERN, s + 8);
|
||||
return ptr + 4;
|
||||
} else
|
||||
{
|
||||
abort();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *operator new(size_t s) //throw(std::bad_alloc)
|
||||
{
|
||||
return mynew(s);
|
||||
}
|
||||
|
||||
void *operator new[](std::size_t s) //throw(std::bad_alloc)
|
||||
{
|
||||
return mynew(s);
|
||||
}
|
||||
|
||||
void *operator new(size_t s, const std::nothrow_t &) throw()
|
||||
{
|
||||
return mynew(s);
|
||||
}
|
||||
|
||||
void *operator new[](size_t s, const std::nothrow_t &) throw()
|
||||
{
|
||||
return mynew(s);
|
||||
}
|
||||
|
||||
void mydelete(void *p)
|
||||
{
|
||||
if(p)
|
||||
{
|
||||
uint8_t *realp = (uint8_t *)p - 4;
|
||||
#ifdef VMP_GNU
|
||||
size_t s = malloc_usable_size(realp);
|
||||
#else
|
||||
size_t s = _msize(realp);
|
||||
#endif
|
||||
uint8_t *endp = realp + s;
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
bool needAbort = false;
|
||||
if(realp[i] != PATTERN)
|
||||
{
|
||||
std::cout << "Heap underflow at " << p << std::endl;
|
||||
needAbort = true;
|
||||
}
|
||||
if(*--endp != PATTERN)
|
||||
{
|
||||
std::cout << "Heap overflow at " << p << std::endl;
|
||||
needAbort = true;
|
||||
}
|
||||
if(needAbort)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
memset(realp, 0x55, s);
|
||||
free(realp);
|
||||
}
|
||||
|
||||
}
|
||||
void operator delete(void *p) throw()
|
||||
{
|
||||
mydelete(p);
|
||||
}
|
||||
void operator delete[](void *p) throw()
|
||||
{
|
||||
mydelete(p);
|
||||
}
|
||||
|
||||
void operator delete[](void *p, const std::nothrow_t &) throw()
|
||||
{
|
||||
mydelete(p);
|
||||
}
|
||||
|
||||
void operator delete(void *p, const std::nothrow_t &) throw()
|
||||
{
|
||||
mydelete(p);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#ifndef ICORE_PCH
|
||||
#define ICORE_PCH
|
||||
|
||||
#include "../../runtime/precommon.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdarg.h>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <math.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifndef SCI_LEXER
|
||||
#error "Please define SCI_LEXER macro for syntax highlighter"
|
||||
#endif
|
||||
|
||||
#endif //ICORE_PCH
|
||||
@@ -0,0 +1 @@
|
||||
#include "precompiled_c.h"
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#ifndef ICORE_C_PCH
|
||||
#define ICORE_C_PCH
|
||||
|
||||
#include "../../runtime/precommon.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <float.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WIN_DRIVER
|
||||
#include <windef.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VMP_GNU
|
||||
#else
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#endif //ICORE_C_PCH
|
||||
@@ -0,0 +1,81 @@
|
||||
echo lang.bat: generating default lang strings...
|
||||
set lang_in="%1langs\en.lng"
|
||||
set lang_out_def="%1core\lang_def.inc"
|
||||
set lang_out_enum="%1core\lang_enum.inc"
|
||||
set lang_out_info="%1core\lang_info.inc"
|
||||
set lang_def=%lang_out_def%
|
||||
set lang_enum=%lang_out_enum%
|
||||
set lang_info=%lang_out_info%
|
||||
set check_def=0
|
||||
if exist %lang_out_def% (
|
||||
set lang_out_def="%1core\lang_def.tmp"
|
||||
set check_def=1
|
||||
)
|
||||
set check_enum=0
|
||||
if exist %lang_out_enum% (
|
||||
set lang_out_enum="%1core\lang_enum.tmp"
|
||||
set check_enum=1
|
||||
)
|
||||
set check_info=0
|
||||
if exist %lang_out_info% (
|
||||
set lang_out_info="%1core\lang_info.tmp"
|
||||
set check_info=1
|
||||
)
|
||||
set area=[Main]
|
||||
set currarea=
|
||||
|
||||
echo {> %lang_out_def%
|
||||
|
||||
echo enum LangString {> %lang_out_enum%
|
||||
|
||||
echo static const struct {> %lang_out_info%
|
||||
echo size_t id;>> %lang_out_info%
|
||||
echo const char *name;>> %lang_out_info%
|
||||
echo } key_info[] = {>> %lang_out_info%
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
for /f "usebackq delims=" %%a in (!lang_in!) do (
|
||||
set ln=%%a
|
||||
if "x!ln:~0,1!"=="x[" (
|
||||
set currarea=!ln!
|
||||
) else if "x!area!"=="x!currarea!" (
|
||||
rem for preserving exclamation marks in data:
|
||||
setlocal disabledelayedexpansion
|
||||
for /f "tokens=1* delims==" %%b in ("%%a") do (
|
||||
set currkey=%%b
|
||||
set currval=%%c
|
||||
setlocal enabledelayedexpansion
|
||||
echo default_values_[ls!currkey!] = replace_escape_chars^("!currval:"=\"!"^);>> !lang_out_def!
|
||||
echo ls!currkey!,>> !lang_out_enum!
|
||||
echo {ls!currkey!, "!currkey:"=\"!"},>> !lang_out_info!
|
||||
endlocal
|
||||
)
|
||||
endlocal
|
||||
)
|
||||
)
|
||||
echo };>> %lang_out_def%
|
||||
echo lsCNT };>> %lang_out_enum%
|
||||
echo };>> %lang_out_info%
|
||||
endlocal
|
||||
|
||||
call :ReplaceOld %check_def% %lang_out_def% %lang_def% default
|
||||
call :ReplaceOld %check_enum% %lang_out_enum% %lang_enum% enum
|
||||
call :ReplaceOld %check_info% %lang_out_info% %lang_info% info
|
||||
goto :EOF
|
||||
|
||||
:ReplaceOld
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
if "%1" == "1" (
|
||||
fc %2 %3 /B>>nul 2>&1
|
||||
if !ERRORLEVEL! == 1 (
|
||||
copy /y %2 %3>>nul 2>&1
|
||||
del %2>>nul 2>&1
|
||||
echo lang.bat: %4 lang strings '%3' are updated
|
||||
) else (
|
||||
echo lang.bat: %4 lang strings '%3' are up to date
|
||||
)
|
||||
) else (
|
||||
echo lang.bat: %4 lang strings '%3' are generated
|
||||
)
|
||||
endlocal
|
||||
goto :EOF
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
#include "objects.h"
|
||||
#include "inifile.h"
|
||||
#include "osutils.h"
|
||||
#include "lang.h"
|
||||
|
||||
LangStringList language;
|
||||
|
||||
/**
|
||||
* Language
|
||||
*/
|
||||
|
||||
Language::Language(LanguageManager *owner, std::string id, const std::string &file_name)
|
||||
: IObject(), owner_(owner), id_(id), file_name_(file_name)
|
||||
{
|
||||
name_ = os::GetLocaleName(id_.c_str());
|
||||
}
|
||||
|
||||
Language::~Language()
|
||||
{
|
||||
if (owner_)
|
||||
owner_->RemoveObject(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* LanguageManager
|
||||
*/
|
||||
|
||||
LanguageManager::LanguageManager()
|
||||
: ObjectList<Language>()
|
||||
{
|
||||
std::string path = os::GetExecutablePath();
|
||||
std::vector<std::string> lang_files = os::FindFiles(os::CombinePaths(path.c_str(), "langs").c_str(), "*.lng");
|
||||
for (size_t i = 0; i < lang_files.size(); i++) {
|
||||
Add(lang_files[i]);
|
||||
}
|
||||
if (!GetLanguageById(default_language()))
|
||||
InsertObject(0, new Language(this, default_language(), ""));
|
||||
}
|
||||
|
||||
void LanguageManager::Add(const std::string &file_name)
|
||||
{
|
||||
std::string id = os::ChangeFileExt(os::ExtractFileName(file_name.c_str()).c_str(), "");
|
||||
|
||||
Language *lang = new Language(this, id, file_name);
|
||||
AddObject(lang);
|
||||
}
|
||||
|
||||
void LanguageManager::set_language(const std::string &id)
|
||||
{
|
||||
Language *lang = GetLanguageById(id);
|
||||
if (!lang)
|
||||
return;
|
||||
|
||||
if (lang->file_name().empty())
|
||||
language.use_defaults();
|
||||
else
|
||||
language.ReadFromFile(lang->file_name().c_str());
|
||||
}
|
||||
|
||||
Language *LanguageManager::GetLanguageById(const std::string &id) const
|
||||
{
|
||||
for (size_t i = 0; i < count(); i++) {
|
||||
Language *lang = item(i);
|
||||
if (lang->id() == id)
|
||||
return lang;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* LangStringList
|
||||
*/
|
||||
|
||||
std::string replace_escape_chars(const char *str)
|
||||
{
|
||||
std::string res;
|
||||
while (*str) {
|
||||
if (*str == '\\' && *(str + 1) == 'n') {
|
||||
res += '\n';
|
||||
str++;
|
||||
} else {
|
||||
res += *str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
LangStringList::LangStringList()
|
||||
{
|
||||
#include "lang_def.inc"
|
||||
use_defaults();
|
||||
}
|
||||
|
||||
void LangStringList::use_defaults()
|
||||
{
|
||||
for (size_t j = 0; j < lsCNT; j++) {
|
||||
values_[j] = default_values_[j];
|
||||
}
|
||||
}
|
||||
|
||||
void LangStringList::ReadFromFile(const char *file_name)
|
||||
{
|
||||
IniFile ini_file(file_name);
|
||||
ReadFromIni(ini_file);
|
||||
}
|
||||
|
||||
void LangStringList::ReadFromIni(IIniFile &file)
|
||||
{
|
||||
#include "lang_info.inc" //key_info.id is unnecessary but informative
|
||||
for (size_t j = 0; j < _countof(key_info); j++) {
|
||||
values_[j] = replace_escape_chars(file.ReadString("Main", key_info[j].name, default_values_[j].c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
std::string LangStringList::operator[](LangString id) const
|
||||
{
|
||||
assert(id != lsCNT);
|
||||
if (id == lsCNT)
|
||||
return std::string();
|
||||
return values_[id];
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#ifndef LANG_H
|
||||
#define LANG_H
|
||||
|
||||
class LanguageManager;
|
||||
class IIniFile;
|
||||
|
||||
class Language : public IObject
|
||||
{
|
||||
public:
|
||||
explicit Language(LanguageManager *owner, std::string id, const std::string &file_name);
|
||||
~Language();
|
||||
std::string id() const { return id_; }
|
||||
std::string file_name() const { return file_name_; }
|
||||
std::string name() const { return name_; }
|
||||
private:
|
||||
LanguageManager *owner_;
|
||||
std::string id_;
|
||||
std::string file_name_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class LanguageManager : public ObjectList<Language>
|
||||
{
|
||||
public:
|
||||
explicit LanguageManager();
|
||||
void set_language(const std::string &id);
|
||||
Language *GetLanguageById(const std::string &id) const;
|
||||
static std::string default_language() { return "en"; }
|
||||
private:
|
||||
void Add(const std::string &file_name);
|
||||
};
|
||||
|
||||
#include "lang_enum.inc"
|
||||
|
||||
class LangStringList
|
||||
{
|
||||
public:
|
||||
LangStringList();
|
||||
void ReadFromFile(const char *file_name);
|
||||
void use_defaults();
|
||||
std::string operator[](LangString index) const;
|
||||
private:
|
||||
void ReadFromIni(IIniFile &file);
|
||||
std::string values_[lsCNT], default_values_[lsCNT];
|
||||
};
|
||||
|
||||
extern LangStringList language;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
SOURCES := \
|
||||
$(addprefix ../core/, \
|
||||
core.cc \
|
||||
files.cc \
|
||||
inifile.cc \
|
||||
dotnetfile.cc \
|
||||
dwarf.cc \
|
||||
elffile.cc \
|
||||
intel.cc \
|
||||
il.cc \
|
||||
lang.cc \
|
||||
objc.cc \
|
||||
macfile.cc \
|
||||
objects.cc \
|
||||
osutils.cc \
|
||||
packer.cc \
|
||||
pefile.cc \
|
||||
processors.cc \
|
||||
script.cc \
|
||||
streams.cc) \
|
||||
../runtime/crypto.cc
|
||||
|
||||
|
||||
PROJECT := core
|
||||
TARGET := $(PROJECT).a
|
||||
BIN_DIR := ../bin/$(ARCH_DIR)/$(CFG_DIR)
|
||||
TMP_DIR := ../tmp/lin/$(PROJECT)/$(ARCH_DIR)/$(CFG_DIR)/$(PROJECT)
|
||||
DEFINES := $(CONFIG) -DTIXML_USE_STL -DSPV_LIBRARY -DFFI_BUILDING
|
||||
LFLAGS :=
|
||||
LIBS :=
|
||||
OBJCOMP :=
|
||||
|
||||
OBJECTS := $(addsuffix .o, $(addprefix $(TMP_DIR)/, $(SOURCES)))
|
||||
|
||||
PCH_DIR := $(TMP_DIR)
|
||||
|
||||
include ../lin_common.mak
|
||||
|
||||
clean:
|
||||
-$(DEL_FILE) $(abspath $(OBJECTS))
|
||||
-$(DEL_FILE) $(PCH_CPP)
|
||||
-$(DEL_FILE) $(BIN_TARGET)
|
||||
|
||||
$(TMP_DIR)/%.o: % $(PCH_CPP) $(TMP_DIR)/%/../.sentinel
|
||||
$(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(LIBS) $(OBJCOMP)
|
||||
ar $(SLIBFLAGS) $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := i386-linux-gnu
|
||||
ARCH_DIR := 32
|
||||
include lin_core.mak
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := x86_64-linux-gnu
|
||||
ARCH_DIR := 64
|
||||
include lin_core.mak
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
SOURCES := \
|
||||
$(addprefix ../core/, \
|
||||
core.cc \
|
||||
files.cc \
|
||||
inifile.cc \
|
||||
dotnetfile.cc \
|
||||
dwarf.cc \
|
||||
elffile.cc \
|
||||
intel.cc \
|
||||
il.cc \
|
||||
lang.cc \
|
||||
objc.cc \
|
||||
macfile.cc \
|
||||
objects.cc \
|
||||
osutils.cc \
|
||||
packer.cc \
|
||||
pefile.cc \
|
||||
processors.cc \
|
||||
script.cc \
|
||||
streams.cc) \
|
||||
../runtime/crypto.cc
|
||||
|
||||
|
||||
PROJECT := core
|
||||
TARGET := $(PROJECT).a
|
||||
BIN_DIR := ../bin/$(ARCH_DIR)/$(CFG_DIR)
|
||||
TMP_DIR := ../tmp/mac/$(PROJECT)/$(ARCH_DIR)/$(CFG_DIR)/$(PROJECT)
|
||||
DEFINES := $(CONFIG) -DTIXML_USE_STL -DSPV_LIBRARY -DFFI_BUILDING
|
||||
LFLAGS :=
|
||||
LIBS :=
|
||||
OBJCOMP :=
|
||||
|
||||
OBJECTS := $(addsuffix .o, $(addprefix $(TMP_DIR)/, $(SOURCES)))
|
||||
|
||||
PCH_DIR := $(TMP_DIR)
|
||||
|
||||
include ../mac_common.mak
|
||||
|
||||
clean:
|
||||
-$(DEL_FILE) $(abspath $(OBJECTS))
|
||||
-$(DEL_FILE) $(PCH_CPP)
|
||||
-$(DEL_FILE) $(BIN_TARGET)
|
||||
|
||||
$(TMP_DIR)/%.o: % $(PCH_CPP) $(TMP_DIR)/%/../.sentinel
|
||||
$(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
|
||||
|
||||
$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(LIBS) $(OBJCOMP)
|
||||
libtool $(SLIBFLAGS) -o $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := i386
|
||||
ARCH_DIR := 32
|
||||
include mac_core.mak
|
||||
@@ -0,0 +1,3 @@
|
||||
ARCH := x86_64
|
||||
ARCH_DIR := 64
|
||||
include mac_core.mak
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+6715
File diff suppressed because it is too large
Load Diff
+755
@@ -0,0 +1,755 @@
|
||||
/**
|
||||
* Support of Mach-O executable files.
|
||||
*/
|
||||
|
||||
#ifndef MACFILE_H
|
||||
#define MACFILE_H
|
||||
|
||||
class MacFile;
|
||||
class MacArchitecture;
|
||||
class MacLoadCommandList;
|
||||
class MacSegmentList;
|
||||
class MacSectionList;
|
||||
class MacImport;
|
||||
class MacImportList;
|
||||
class MacFixup;
|
||||
class MacFixupList;
|
||||
class MacRuntimeFunctionList;
|
||||
class CommonInformationEntry;
|
||||
class CommonInformationEntryList;
|
||||
class EncodedData;
|
||||
|
||||
class MacLoadCommand : public BaseLoadCommand
|
||||
{
|
||||
public:
|
||||
explicit MacLoadCommand(MacLoadCommandList *owner);
|
||||
explicit MacLoadCommand(MacLoadCommandList *owner, uint64_t address, uint32_t size, uint32_t type);
|
||||
explicit MacLoadCommand(MacLoadCommandList *owner, uint32_t type, IObject *object);
|
||||
explicit MacLoadCommand(MacLoadCommandList *owner, const MacLoadCommand &src);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint32_t size() const { return size_; }
|
||||
virtual uint32_t type() const { return type_; }
|
||||
virtual std::string name() const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
virtual MacLoadCommand *Clone(ILoadCommandList *owner) const;
|
||||
void Rebase(uint64_t delta_base);
|
||||
void set_offset(uint32_t offset) { offset_ = offset; }
|
||||
void *object() const { return object_; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint32_t size_;
|
||||
uint32_t type_;
|
||||
IObject *object_;
|
||||
uint32_t offset_;
|
||||
};
|
||||
|
||||
class MacLoadCommandList : public BaseCommandList
|
||||
{
|
||||
public:
|
||||
explicit MacLoadCommandList(MacArchitecture *owner);
|
||||
explicit MacLoadCommandList(MacArchitecture *owner, const MacLoadCommandList &src);
|
||||
virtual MacLoadCommandList *Clone(MacArchitecture *owner) const;
|
||||
void ReadFromFile(MacArchitecture &file, size_t count);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
MacLoadCommand *item(size_t index) const;
|
||||
void Pack();
|
||||
void Add(uint32_t type, IObject *object);
|
||||
MacLoadCommand *GetCommandByObject(void *object) const;
|
||||
};
|
||||
|
||||
class MacSegment : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit MacSegment(MacSegmentList *owner);
|
||||
explicit MacSegment(MacSegmentList *owner, uint64_t address, uint64_t size, uint32_t physical_offset,
|
||||
uint32_t physical_size, uint32_t initprot, const std::string &name);
|
||||
explicit MacSegment(MacSegmentList *owner, const MacSegment &src);
|
||||
virtual MacSegment *Clone(ISectionList *owner) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return physical_offset_; }
|
||||
virtual uint32_t physical_size() const { return physical_size_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
virtual uint32_t memory_type() const;
|
||||
virtual void update_type(uint32_t mt);
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
void set_size(uint64_t size) { size_ = size; }
|
||||
void set_physical_offset(uint32_t offset) { physical_offset_ = offset; }
|
||||
void set_physical_size(uint32_t size) { physical_size_ = size; }
|
||||
virtual uint32_t flags() const { return initprot_; }
|
||||
void set_flags(uint32_t flags) { initprot_ = flags; }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
void include_maxprot(vm_prot_t value) { maxprot_ |= value; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint64_t size_;
|
||||
uint32_t physical_offset_;
|
||||
uint32_t physical_size_;
|
||||
uint32_t nsects_;
|
||||
vm_prot_t maxprot_;
|
||||
vm_prot_t initprot_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class MacSegmentList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit MacSegmentList(MacArchitecture *owner);
|
||||
explicit MacSegmentList(MacArchitecture *owner, const MacSegmentList &src);
|
||||
virtual MacSegmentList *Clone(MacArchitecture *owner) const;
|
||||
MacSegment *GetSectionByAddress(uint64_t address) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
MacSegment *item(size_t index) const;
|
||||
MacSegment *last() const;
|
||||
MacSegment *Add(uint64_t address, uint64_t size, uint32_t physical_offset, uint32_t physical_size, uint32_t initprot, const std::string &name);
|
||||
MacSegment *GetSectionByName(const std::string &name) const;
|
||||
MacSegment *GetBaseSegment() const;
|
||||
private:
|
||||
MacSegment *Add();
|
||||
};
|
||||
|
||||
class MacStringTable
|
||||
{
|
||||
public:
|
||||
std::string GetString(uint32_t pos) const;
|
||||
uint32_t AddString(const std::string &str);
|
||||
void clear();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
private:
|
||||
std::vector<char> data_;
|
||||
};
|
||||
|
||||
class MacSymbolList;
|
||||
|
||||
class MacSymbol : public IObject
|
||||
{
|
||||
public:
|
||||
explicit MacSymbol(MacSymbolList *owner);
|
||||
explicit MacSymbol(MacSymbolList *owner, const MacSymbol &src);
|
||||
~MacSymbol();
|
||||
virtual MacSymbol *Clone(MacSymbolList *owner) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
uint8_t type() const { return type_; }
|
||||
uint8_t sect() const { return sect_; }
|
||||
uint16_t desc() const { return desc_; }
|
||||
uint64_t value() const { return value_; }
|
||||
std::string name() const { return name_; }
|
||||
bool is_deleted() const { return is_deleted_; }
|
||||
void set_deleted(bool value) { is_deleted_ = value; }
|
||||
uint8_t library_ordinal() const;
|
||||
void set_library_ordinal(uint8_t library_ordinal);
|
||||
void set_value(uint64_t value) { value_ = value; }
|
||||
private:
|
||||
MacSymbolList *owner_;
|
||||
uint8_t type_;
|
||||
uint8_t sect_;
|
||||
uint16_t desc_;
|
||||
uint64_t value_;
|
||||
std::string name_;
|
||||
bool is_deleted_;
|
||||
};
|
||||
|
||||
class MacSymbolList : public ObjectList<MacSymbol>
|
||||
{
|
||||
public:
|
||||
explicit MacSymbolList();
|
||||
explicit MacSymbolList(const MacSymbolList &src);
|
||||
virtual MacSymbolList *Clone() const;
|
||||
void ReadFromFile(MacArchitecture &file, size_t count);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
MacSymbol *GetSymbol(const std::string &name, int library_ordinal) const;
|
||||
void Pack();
|
||||
private:
|
||||
// no assignment op
|
||||
MacSymbolList &operator =(const MacSymbolList &);
|
||||
};
|
||||
|
||||
class MacSection : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit MacSection(MacSectionList *owner, MacSegment *parent);
|
||||
explicit MacSection(MacSectionList *owner, MacSegment *parent, uint64_t address, uint32_t size, uint32_t offset, uint32_t flags, const std::string &name, const std::string &segment_name);
|
||||
explicit MacSection(MacSectionList *owner, const MacSection &src);
|
||||
~MacSection();
|
||||
uint32_t type() const { return flags_ & SECTION_TYPE; }
|
||||
uint32_t reserved1() const { return reserved1_; }
|
||||
uint32_t reserved2() const { return reserved2_; }
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return offset_; }
|
||||
virtual uint32_t physical_size() const { return size_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual uint32_t memory_type() const { return parent_->memory_type(); }
|
||||
virtual MacSegment *parent() const { return parent_; }
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
virtual MacSection *Clone(ISectionList *owner) const;
|
||||
void set_parent(MacSegment *parent) { parent_ = parent; }
|
||||
virtual void update_type(uint32_t mt) { }
|
||||
virtual uint32_t flags() const { return flags_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
void set_physical_offset(uint32_t physical_offset) { offset_ = physical_offset; }
|
||||
void set_physical_size(uint32_t physical_size) { size_ = physical_size; }
|
||||
void set_flags(uint32_t flags) { flags_ = flags; }
|
||||
void set_reserved1(uint32_t reserved1) { reserved1_ = reserved1; }
|
||||
void set_reserved2(uint32_t reserved2) { reserved2_ = reserved2; }
|
||||
void set_alignment(size_t value);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
std::string segment_name() const { return segment_name_; }
|
||||
private:
|
||||
std::string name_;
|
||||
std::string segment_name_;
|
||||
uint64_t address_;
|
||||
uint32_t size_;
|
||||
uint32_t offset_;
|
||||
uint32_t align_;
|
||||
uint32_t reloff_;
|
||||
uint32_t nreloc_;
|
||||
uint32_t flags_;
|
||||
uint32_t reserved1_;
|
||||
uint32_t reserved2_;
|
||||
MacSegment *parent_;
|
||||
};
|
||||
|
||||
class MacSectionList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit MacSectionList(MacArchitecture *owner);
|
||||
explicit MacSectionList(MacArchitecture *owner, const MacSectionList &src);
|
||||
virtual MacSectionList *Clone(MacArchitecture *owner) const;
|
||||
void ReadFromFile(MacArchitecture &file, size_t count, MacSegment *segment);
|
||||
MacSection *item(size_t index) const;
|
||||
MacSection *GetSectionByAddress(uint64_t address) const;
|
||||
MacSection *GetSectionByName(const std::string &name) const;
|
||||
MacSection *GetSectionByName(ISection *segment, const std::string &name) const;
|
||||
MacSection *Add(MacSegment *segment, uint64_t address, uint32_t size, uint32_t offset, uint32_t flags, const std::string &name, const std::string &segment_name);
|
||||
};
|
||||
|
||||
class MacImportFunction : public BaseImportFunction
|
||||
{
|
||||
public:
|
||||
explicit MacImportFunction(IImport *owner, uint64_t address, APIType type, MapFunction *map_function);
|
||||
explicit MacImportFunction(IImport *owner, uint64_t address, uint8_t bind_type, size_t bind_offset,
|
||||
const std::string &name, uint32_t flags, int64_t addend, bool is_lazy, MacSymbol *symbol);
|
||||
explicit MacImportFunction(IImport *owner, const MacImportFunction &src);
|
||||
virtual MacImportFunction *Clone(IImport *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
uint32_t flags() const { return flags_; }
|
||||
int64_t addend() const { return addend_; }
|
||||
MacSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(MacSymbol *symbol) { symbol_ = symbol; }
|
||||
uint8_t bind_type() const { return bind_type_; }
|
||||
bool is_lazy() const { return is_lazy_; }
|
||||
bool is_weak() const;
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
int library_ordinal() const;
|
||||
size_t bind_offset() const { return bind_offset_; }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
void set_bind_offset(size_t bind_offset) { bind_offset_ = bind_offset; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint8_t bind_type_;
|
||||
std::string name_;
|
||||
uint32_t flags_;
|
||||
int64_t addend_;
|
||||
bool is_lazy_;
|
||||
MacSymbol *symbol_;
|
||||
size_t bind_offset_;
|
||||
};
|
||||
|
||||
class MacImport : public BaseImport
|
||||
{
|
||||
public:
|
||||
explicit MacImport(MacImportList *owner, int library_ordinal, bool is_sdk = false);
|
||||
explicit MacImport(MacImportList *owner, int library_ordinal, const std::string &name, uint32_t current_version, uint32_t compatibility_version);
|
||||
explicit MacImport(MacImportList *owner, const MacImport &src);
|
||||
virtual MacImport *Clone(IImportList *owner) const;
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual bool is_sdk() const { return is_sdk_; }
|
||||
void set_is_sdk(bool is_sdk) { is_sdk_ = is_sdk; }
|
||||
int library_ordinal() const { return library_ordinal_; }
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
MacImportFunction *Add(uint64_t address, uint8_t bind_type, size_t bind_offset, const std::string &name, uint32_t flags, int64_t addend, bool is_lazy, MacSymbol *symbol);
|
||||
MacImportFunction *item(size_t index) const;
|
||||
virtual MacImportFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
uint32_t current_version() const { return current_version_; }
|
||||
uint32_t compatibility_version() const { return compatibility_version_; }
|
||||
void set_library_ordinal(int library_ordinal) { library_ordinal_ = library_ordinal; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
bool is_weak() const { return is_weak_; }
|
||||
void set_is_weak(bool is_weak) { is_weak_ = is_weak; }
|
||||
protected:
|
||||
virtual MacImportFunction *Add(uint64_t address, APIType type, MapFunction *map_function);
|
||||
private:
|
||||
int library_ordinal_;
|
||||
bool is_weak_;
|
||||
std::string name_;
|
||||
bool is_sdk_;
|
||||
uint32_t timestamp_;
|
||||
uint32_t current_version_;
|
||||
uint32_t compatibility_version_;
|
||||
};
|
||||
|
||||
class MacImportList : public BaseImportList
|
||||
{
|
||||
public:
|
||||
explicit MacImportList(MacArchitecture *owner);
|
||||
explicit MacImportList(MacArchitecture *owner, const MacImportList &src);
|
||||
virtual MacImportList *Clone(MacArchitecture *owner) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
MacImport *item(size_t index) const;
|
||||
MacImportFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
void Pack();
|
||||
MacImport *GetLibraryByOrdinal(int library_ordinal) const;
|
||||
virtual MacImport *GetImportByName(const std::string &name) const;
|
||||
void RebaseBindInfo(MacArchitecture &file, size_t delta_base);
|
||||
virtual const ImportInfo *GetSDKInfo(const std::string &name) const;
|
||||
int GetMaxLibraryOrdinal() const;
|
||||
protected:
|
||||
virtual MacImport *AddSDK();
|
||||
private:
|
||||
void ReadBindInfo(MacArchitecture &file, uint32_t bind_off, uint32_t bind_size);
|
||||
void ReadLazyBindInfo(MacArchitecture &file, uint32_t lazy_bind_off, uint32_t lazy_bind_size);
|
||||
size_t WriteBindInfo(MacArchitecture &file);
|
||||
size_t WriteWeakBindInfo(MacArchitecture &file);
|
||||
size_t WriteLazyBindInfo(MacArchitecture &file);
|
||||
MacImport *Add(int library_ordinal);
|
||||
|
||||
struct BindInfoHelper {
|
||||
bool operator () (const MacImportFunction *left, const MacImportFunction *right) const
|
||||
{
|
||||
// sort by library, symbol, type, then address
|
||||
if (left->library_ordinal() != right->library_ordinal())
|
||||
return (left->library_ordinal() < right->library_ordinal());
|
||||
if (left->name() != right->name())
|
||||
return (left->name() < right->name());
|
||||
if (left->bind_type() != right->bind_type())
|
||||
return (left->bind_type() < right->bind_type());
|
||||
return (left->address() < right->address());
|
||||
}
|
||||
};
|
||||
|
||||
struct WeakBindInfoHelper {
|
||||
bool operator () (const MacImportFunction *left, const MacImportFunction *right) const
|
||||
{
|
||||
// sort by symbol, type, address
|
||||
if (left->name() != right->name())
|
||||
return (left->name() < right->name());
|
||||
if (left->bind_type() != right->bind_type())
|
||||
return (left->bind_type() < right->bind_type());
|
||||
return (left->address() < right->address());
|
||||
}
|
||||
};
|
||||
|
||||
struct LazyBindInfoHelper {
|
||||
bool operator () (const MacImportFunction *left, const MacImportFunction *right) const
|
||||
{
|
||||
return (left->bind_offset() < right->bind_offset());
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class MacIndirectSymbolList;
|
||||
|
||||
class MacIndirectSymbol : public IObject
|
||||
{
|
||||
public:
|
||||
explicit MacIndirectSymbol(MacIndirectSymbolList *owner, uint64_t address, uint32_t value, MacSymbol *symbol);
|
||||
explicit MacIndirectSymbol(MacIndirectSymbolList *owner, const MacIndirectSymbol &src);
|
||||
~MacIndirectSymbol();
|
||||
virtual MacIndirectSymbol *Clone(MacIndirectSymbolList *owner) const;
|
||||
uint64_t address() const { return address_; }
|
||||
uint32_t value() const { return value_; }
|
||||
MacSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(MacSymbol *symbol) { symbol_ = symbol; }
|
||||
void set_value(uint32_t value) { value_ = value; }
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
MacIndirectSymbolList *owner_;
|
||||
uint64_t address_;
|
||||
uint32_t value_;
|
||||
MacSymbol *symbol_;
|
||||
};
|
||||
|
||||
class MacIndirectSymbolList : public ObjectList<MacIndirectSymbol>
|
||||
{
|
||||
public:
|
||||
explicit MacIndirectSymbolList();
|
||||
explicit MacIndirectSymbolList(const MacIndirectSymbolList &src);
|
||||
virtual MacIndirectSymbolList *Clone() const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
void Pack();
|
||||
MacIndirectSymbol *Add(uint64_t address, uint32_t value, MacSymbol *symbol);
|
||||
MacIndirectSymbol *GetSymbol(MacSymbol *symbol) const;
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
// no assignment op
|
||||
MacIndirectSymbolList &operator =(const MacIndirectSymbolList &);
|
||||
};
|
||||
|
||||
class MacExtRefSymbolList;
|
||||
|
||||
class MacExtRefSymbol : public IObject
|
||||
{
|
||||
public:
|
||||
explicit MacExtRefSymbol(MacExtRefSymbolList *owner, MacSymbol *symbol, uint8_t flags);
|
||||
explicit MacExtRefSymbol(MacExtRefSymbolList *owner, const MacExtRefSymbol &src);
|
||||
~MacExtRefSymbol();
|
||||
virtual MacExtRefSymbol *Clone(MacExtRefSymbolList *owner) const;
|
||||
MacSymbol *symbol() const { return symbol_; }
|
||||
uint8_t flags() const { return flags_; }
|
||||
void set_symbol(MacSymbol *symbol) { symbol_ = symbol; }
|
||||
private:
|
||||
MacExtRefSymbolList *owner_;
|
||||
MacSymbol *symbol_;
|
||||
uint8_t flags_;
|
||||
};
|
||||
|
||||
class MacExtRefSymbolList : public ObjectList<MacExtRefSymbol>
|
||||
{
|
||||
public:
|
||||
explicit MacExtRefSymbolList();
|
||||
explicit MacExtRefSymbolList(const MacExtRefSymbolList &src);
|
||||
virtual MacExtRefSymbolList *Clone() const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
void Pack();
|
||||
MacExtRefSymbol *Add(MacSymbol *symbol, uint8_t flags);
|
||||
MacExtRefSymbol *GetSymbol(MacSymbol *symbol) const;
|
||||
private:
|
||||
// no assignment op
|
||||
MacExtRefSymbolList &operator =(const MacExtRefSymbolList &);
|
||||
};
|
||||
|
||||
class MacExport : public BaseExport
|
||||
{
|
||||
public:
|
||||
explicit MacExport(IExportList *parent, uint64_t address, const std::string &name, uint64_t flags, uint64_t other);
|
||||
explicit MacExport(IExportList *parent, MacSymbol *symbol);
|
||||
explicit MacExport(IExportList *parent, const MacExport &src);
|
||||
virtual MacExport *Clone(IExportList *parent) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
void set_address(uint64_t address);
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual std::string forwarded_name() const { return forwarded_name_; }
|
||||
uint64_t flags() const { return flags_; }
|
||||
uint64_t other() const { return other_; }
|
||||
void set_forwarded_name(const std::string &forwarded_name) { forwarded_name_ = forwarded_name; }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
MacSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(MacSymbol *symbol) { symbol_ = symbol; }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
MacSymbol *symbol_;
|
||||
uint64_t address_;
|
||||
std::string name_;
|
||||
std::string forwarded_name_;
|
||||
uint64_t flags_;
|
||||
uint64_t other_;
|
||||
};
|
||||
|
||||
class MacExportList : public BaseExportList
|
||||
{
|
||||
public:
|
||||
explicit MacExportList(MacArchitecture *owner);
|
||||
explicit MacExportList(MacArchitecture *owner, const MacExportList &src);
|
||||
virtual MacExportList *Clone(MacArchitecture *owner) const;
|
||||
virtual std::string name() const { return name_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
MacExport *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void Pack();
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
MacExport *GetExportByAddress(uint64_t address) const;
|
||||
protected:
|
||||
virtual MacExport *Add(uint64_t address) { return Add(address, std::string(), 0, 0); }
|
||||
private:
|
||||
MacExport *Add(uint64_t address, const std::string &name, uint64_t flags, uint64_t other);
|
||||
MacExport *Add(MacSymbol *symbol);
|
||||
void ParseExportNode(const EncodedData &buf, size_t pos, const std::string &name, uint64_t base_address);
|
||||
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class MacExportNode : public ObjectList<MacExportNode>
|
||||
{
|
||||
public:
|
||||
explicit MacExportNode(MacExportNode *owner = NULL);
|
||||
explicit MacExportNode(MacExportNode *owner, MacExport *symbol, const std::string &cummulative_string_);
|
||||
~MacExportNode();
|
||||
void set_owner(MacExportNode *owner);
|
||||
void AddSymbol(MacExport *symbol);
|
||||
std::string cummulative_string() const { return cummulative_string_; }
|
||||
void WriteToData(EncodedData &data, uint64_t base_address);
|
||||
uint32_t offset() const { return offset_; }
|
||||
private:
|
||||
MacExportNode *Add(MacExport *symbol, const std::string &cummulative_string_);
|
||||
|
||||
MacExportNode *owner_;
|
||||
MacExport *symbol_;
|
||||
std::string cummulative_string_;
|
||||
uint32_t offset_;
|
||||
};
|
||||
|
||||
class MacFixup : public BaseFixup
|
||||
{
|
||||
public:
|
||||
explicit MacFixup(MacFixupList *owner, uint64_t address, uint32_t data, OperandSize size, bool is_relocation);
|
||||
explicit MacFixup(MacFixupList *owner, const MacFixup &src);
|
||||
virtual MacFixup *Clone(IFixupList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual FixupType type() const;
|
||||
uint8_t internal_type() const;
|
||||
virtual OperandSize size() const { return size_; }
|
||||
virtual void set_address(uint64_t address) { address_ = address; }
|
||||
uint8_t bind_type() const { return static_cast<uint8_t>(data_); }
|
||||
relocation_info relocation() const;
|
||||
bool is_relocation() const { return is_relocation_; }
|
||||
void set_is_relocation(bool is_relocation);
|
||||
MacSymbol *symbol() const { return symbol_; }
|
||||
void set_symbol(MacSymbol *symbol) { symbol_ = symbol; }
|
||||
virtual void Rebase(IArchitecture &file, uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
MacSymbol *symbol_;
|
||||
uint32_t data_;
|
||||
OperandSize size_;
|
||||
bool is_relocation_;
|
||||
};
|
||||
|
||||
class MacFixupList : public BaseFixupList
|
||||
{
|
||||
public:
|
||||
explicit MacFixupList();
|
||||
explicit MacFixupList(const MacFixupList &src);
|
||||
virtual MacFixupList *Clone() const;
|
||||
MacFixup *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void WriteToFile(MacArchitecture &file);
|
||||
virtual MacFixup *AddDefault(OperandSize cpu_address_size, bool is_code);
|
||||
virtual size_t Pack();
|
||||
void WriteToData(Data &data, uint64_t image_base);
|
||||
MacFixup *AddRelocation(uint64_t address, MacSymbol *symbol, OperandSize size);
|
||||
private:
|
||||
MacFixup *Add(uint64_t address, uint32_t data, OperandSize size, bool is_relocation);
|
||||
void ReadRebaseInfo(MacArchitecture &file, uint32_t rebase_off, uint32_t rebase_size);
|
||||
void ReadRelocations(MacArchitecture &file, uint32_t offset, uint32_t count, bool need_external);
|
||||
size_t WriteRebaseInfo(MacArchitecture &file);
|
||||
size_t WriteRelocations(MacArchitecture &file, bool need_external);
|
||||
|
||||
// no assignment op
|
||||
MacFixupList &operator =(const MacFixupList &);
|
||||
|
||||
struct RebaseInfoHelper {
|
||||
bool operator () (const MacFixup *left, const MacFixup *right) const;
|
||||
};
|
||||
|
||||
struct RebaseInfo {
|
||||
uint8_t opcode;
|
||||
uint64_t operand1;
|
||||
uint64_t operand2;
|
||||
RebaseInfo(uint8_t opcode_, uint64_t operand1_, uint64_t operand2_ = 0)
|
||||
{
|
||||
opcode = opcode_;
|
||||
operand1 = operand1_;
|
||||
operand2 = operand2_;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class MacRuntimeFunction : public BaseRuntimeFunction
|
||||
{
|
||||
public:
|
||||
explicit MacRuntimeFunction(MacRuntimeFunctionList *owner, uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, CommonInformationEntry *cie,
|
||||
const std::vector<uint8_t> &call_frame_instructions, uint32_t compact_encoding);
|
||||
explicit MacRuntimeFunction(MacRuntimeFunctionList *owner, const MacRuntimeFunction &src);
|
||||
virtual MacRuntimeFunction *Clone(IRuntimeFunctionList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t begin() const { return begin_; }
|
||||
virtual uint64_t end() const { return end_; }
|
||||
virtual uint64_t unwind_address() const { return unwind_address_; }
|
||||
uint32_t compact_encoding() const { return compact_encoding_; }
|
||||
virtual void set_begin(uint64_t begin) { begin_ = begin; }
|
||||
virtual void set_end(uint64_t end) { end_ = end; }
|
||||
virtual void set_unwind_address(uint64_t unwind_address) { unwind_address_ = unwind_address; }
|
||||
CommonInformationEntry *cie() const { return cie_; }
|
||||
void set_cie(CommonInformationEntry *cie) { cie_ = cie; }
|
||||
std::vector<uint8_t> call_frame_instructions() const { return call_frame_instructions_; }
|
||||
virtual void Parse(IArchitecture &file, IFunction &dest);
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
void ParseBorland(IArchitecture &file, IFunction &func);
|
||||
void ParseDwarf(IArchitecture &file, IFunction &func);
|
||||
|
||||
uint64_t address_;
|
||||
uint64_t begin_;
|
||||
uint64_t end_;
|
||||
uint64_t unwind_address_;
|
||||
uint32_t compact_encoding_;
|
||||
CommonInformationEntry *cie_;
|
||||
std::vector<uint8_t> call_frame_instructions_;
|
||||
};
|
||||
|
||||
class MacRuntimeFunctionList : public BaseRuntimeFunctionList
|
||||
{
|
||||
public:
|
||||
explicit MacRuntimeFunctionList();
|
||||
explicit MacRuntimeFunctionList(const MacRuntimeFunctionList &src);
|
||||
~MacRuntimeFunctionList();
|
||||
virtual void clear();
|
||||
MacRuntimeFunctionList *Clone() const;
|
||||
MacRuntimeFunction *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
size_t WriteToFile(MacArchitecture &file, bool compact_info);
|
||||
void Rebase(uint64_t delta_base);
|
||||
virtual MacRuntimeFunction *Add(uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, IRuntimeFunction *source, const std::vector<uint8_t> &call_frame_instructions);
|
||||
virtual MacRuntimeFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
CommonInformationEntryList *cie_list() const { return cie_list_; }
|
||||
private:
|
||||
void ReadBorlandInfo(MacArchitecture &file, uint64_t address);
|
||||
void ReadCompactInfo(MacArchitecture &file, uint64_t address, uint32_t size);
|
||||
void ReadDwarfInfo(MacArchitecture &file, uint64_t address, uint32_t size);
|
||||
MacRuntimeFunction *Add(uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, CommonInformationEntry *cie, const std::vector<uint8_t> &call_frame_instructions, uint32_t compact_encoding);
|
||||
|
||||
size_t WriteDwarfInfo(MacArchitecture &file);
|
||||
size_t WriteCompactInfo(MacArchitecture &file);
|
||||
uint64_t address_;
|
||||
CommonInformationEntryList *cie_list_;
|
||||
|
||||
// no assignment op
|
||||
MacRuntimeFunctionList &operator =(const MacRuntimeFunctionList &);
|
||||
};
|
||||
|
||||
class MacArchitecture : public BaseArchitecture
|
||||
{
|
||||
public:
|
||||
explicit MacArchitecture(MacFile *owner, uint64_t offset, uint64_t size);
|
||||
explicit MacArchitecture(MacFile *owner, const MacArchitecture &src);
|
||||
virtual ~MacArchitecture();
|
||||
virtual std::string name() const;
|
||||
virtual uint32_t type() const { return cpu_type_; }
|
||||
uint32_t cpu_subtype() const { return cpu_subtype_; }
|
||||
virtual OperandSize cpu_address_size() const { return cpu_address_size_; }
|
||||
uint32_t flags() const { return flags_; }
|
||||
virtual uint64_t entry_point() const;
|
||||
virtual uint64_t image_base() const { return image_base_; }
|
||||
uint32_t segment_alignment() const { return 0x1000; }
|
||||
uint32_t file_alignment() const { return 0x1000; }
|
||||
virtual MacLoadCommandList *command_list() const { return command_list_; }
|
||||
virtual MacSegmentList *segment_list() const { return segment_list_; }
|
||||
virtual MacImportList *import_list() const { return import_list_; }
|
||||
virtual MacExportList *export_list() const { return export_list_; }
|
||||
virtual MacFixupList *fixup_list() const { return fixup_list_; }
|
||||
virtual IRelocationList *relocation_list() const { return NULL; }
|
||||
virtual IResourceList *resource_list() const { return NULL; }
|
||||
virtual ISEHandlerList *seh_handler_list() const { return NULL; }
|
||||
virtual MacRuntimeFunctionList *runtime_function_list() const { return runtime_function_list_; }
|
||||
virtual IFunctionList *function_list() const { return function_list_; }
|
||||
virtual IVirtualMachineList *virtual_machine_list() const { return virtual_machine_list_; }
|
||||
virtual MacSectionList *section_list() const { return section_list_; }
|
||||
MacSymbolList *symbol_list() const { return symbol_list_; }
|
||||
MacIndirectSymbolList *indirect_symbol_list() const { return indirect_symbol_list_; }
|
||||
OpenStatus ReadFromFile(uint32_t mode);
|
||||
virtual bool WriteToFile();
|
||||
virtual MacArchitecture *Clone(IFile *file) const;
|
||||
virtual bool Compile(CompileOptions &options, IArchitecture *runtime);
|
||||
virtual void Save(CompileContext &ctx);
|
||||
virtual bool is_executable() const;
|
||||
MacStringTable *string_table() { return &string_table_; }
|
||||
symtab_command *symtab() { return &symtab_; }
|
||||
dysymtab_command *dysymtab() { return &dysymtab_; }
|
||||
dyld_info_command *dyld_info() { return &dyld_info_; }
|
||||
uint64_t GetRelocBase() const;
|
||||
virtual CallingConvention calling_convention() const { return cpu_address_size() == osDWord ? ccCdecl : ccABIx64; }
|
||||
void Rebase(uint64_t delta_base, size_t delta_bind_info);
|
||||
MacSegment *header_segment() const { return header_segment_; }
|
||||
uint32_t max_header_size() const { return max_header_size_; }
|
||||
uint32_t file_type() const { return file_type_; }
|
||||
MacSection *runtime_functions_section() const { return runtime_functions_section_; }
|
||||
MacSection *unwind_info_section() const { return unwind_info_section_; }
|
||||
protected:
|
||||
virtual bool Prepare(CompileContext &ctx);
|
||||
private:
|
||||
MacLoadCommandList *command_list_;
|
||||
MacSegmentList *segment_list_;
|
||||
MacSectionList *section_list_;
|
||||
MacSymbolList *symbol_list_;
|
||||
MacImportList *import_list_;
|
||||
MacExportList *export_list_;
|
||||
MacIndirectSymbolList *indirect_symbol_list_;
|
||||
MacExtRefSymbolList *ext_ref_symbol_list_;
|
||||
MacFixupList *fixup_list_;
|
||||
MacRuntimeFunctionList *runtime_function_list_;
|
||||
IFunctionList *function_list_;
|
||||
IVirtualMachineList *virtual_machine_list_;
|
||||
|
||||
cpu_type_t cpu_type_;
|
||||
cpu_subtype_t cpu_subtype_;
|
||||
OperandSize cpu_address_size_;
|
||||
uint64_t image_base_;
|
||||
symtab_command symtab_;
|
||||
dysymtab_command dysymtab_;
|
||||
dyld_info_command dyld_info_;
|
||||
MacStringTable string_table_;
|
||||
uint64_t entry_point_;
|
||||
uint32_t file_type_;
|
||||
uint32_t cmds_size_;
|
||||
uint32_t flags_;
|
||||
uint32_t header_size_;
|
||||
uint32_t segment_alignment_;
|
||||
uint32_t file_alignment_;
|
||||
uint32_t sdk_;
|
||||
MacSegment *linkedit_segment_;
|
||||
size_t optimized_segment_count_;
|
||||
MacSegment *header_segment_;
|
||||
uint32_t max_header_size_;
|
||||
MacSection *runtime_functions_section_;
|
||||
MacSection *unwind_info_section_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
MacArchitecture(const MacArchitecture &);
|
||||
MacArchitecture &operator =(const MacArchitecture &);
|
||||
};
|
||||
|
||||
class MacFile : public IFile
|
||||
{
|
||||
public:
|
||||
explicit MacFile(ILog *log);
|
||||
explicit MacFile(const MacFile &src, const char *file_name);
|
||||
virtual ~MacFile();
|
||||
virtual std::string format_name() const;
|
||||
MacArchitecture *item(size_t index) const;
|
||||
MacFile *Clone(const char *file_name) const;
|
||||
virtual bool Compile(CompileOptions &options);
|
||||
virtual bool is_executable() const;
|
||||
virtual uint32_t disable_options() const;
|
||||
protected:
|
||||
virtual OpenStatus ReadHeader(uint32_t open_mode);
|
||||
virtual IFile *runtime() const { return runtime_; }
|
||||
private:
|
||||
MacArchitecture *Add(uint64_t offset, uint64_t size);
|
||||
|
||||
uint32_t fat_magic_;
|
||||
MacFile *runtime_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
MacFile(const MacFile &);
|
||||
MacFile &operator =(const MacFile &);
|
||||
};
|
||||
|
||||
#endif
|
||||
+2224
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1435
File diff suppressed because it is too large
Load Diff
+772
@@ -0,0 +1,772 @@
|
||||
#ifndef OBJC_H
|
||||
#define OBJC_H
|
||||
|
||||
struct objc_module {
|
||||
uint32_t version;
|
||||
uint32_t size;
|
||||
uint32_t name;
|
||||
uint32_t symtab;
|
||||
};
|
||||
|
||||
struct objc_module_64 {
|
||||
uint32_t version;
|
||||
uint32_t size;
|
||||
uint64_t name;
|
||||
uint64_t symtab;
|
||||
};
|
||||
|
||||
struct objc_symtab {
|
||||
uint32_t sel_ref_cnt;
|
||||
uint32_t refs;
|
||||
uint16_t cls_def_cnt;
|
||||
uint16_t cat_def_cnt;
|
||||
};
|
||||
|
||||
struct objc_symtab_64 {
|
||||
uint32_t sel_ref_cnt;
|
||||
uint64_t refs;
|
||||
uint16_t cls_def_cnt;
|
||||
uint16_t cat_def_cnt;
|
||||
};
|
||||
|
||||
struct objc_class {
|
||||
uint32_t isa;
|
||||
uint32_t super_class;
|
||||
uint32_t name;
|
||||
uint32_t version;
|
||||
uint32_t info;
|
||||
uint32_t instance_size;
|
||||
uint32_t ivars;
|
||||
uint32_t methods;
|
||||
uint32_t cache;
|
||||
uint32_t protocols;
|
||||
};
|
||||
|
||||
struct objc_class_64 {
|
||||
uint64_t isa;
|
||||
uint64_t super_class;
|
||||
uint64_t name;
|
||||
uint64_t version;
|
||||
uint64_t info;
|
||||
uint64_t instance_size;
|
||||
uint64_t ivars;
|
||||
uint64_t methods;
|
||||
uint64_t cache;
|
||||
uint64_t protocols;
|
||||
};
|
||||
|
||||
struct objc_protocol {
|
||||
uint32_t isa;
|
||||
uint32_t name;
|
||||
uint32_t protocols;
|
||||
uint32_t instance_methods;
|
||||
uint32_t class_methods;
|
||||
};
|
||||
|
||||
struct objc_protocol_64 {
|
||||
uint64_t isa;
|
||||
uint64_t name;
|
||||
uint64_t protocols;
|
||||
uint64_t instance_methods;
|
||||
uint64_t class_methods;
|
||||
};
|
||||
|
||||
struct objc_method {
|
||||
uint32_t name;
|
||||
uint32_t types;
|
||||
uint32_t imp;
|
||||
};
|
||||
|
||||
struct objc_method_64 {
|
||||
uint64_t name;
|
||||
uint64_t types;
|
||||
uint64_t imp;
|
||||
};
|
||||
|
||||
struct objc_method_list {
|
||||
uint32_t next;
|
||||
uint32_t count;
|
||||
// objc_method method[1];
|
||||
};
|
||||
|
||||
struct objc_category {
|
||||
uint32_t category_name;
|
||||
uint32_t class_name;
|
||||
uint32_t instance_methods;
|
||||
uint32_t class_methods;
|
||||
uint32_t protocols;
|
||||
};
|
||||
|
||||
struct objc_category_64 {
|
||||
uint64_t category_name;
|
||||
uint64_t class_name;
|
||||
uint64_t instance_methods;
|
||||
uint64_t class_methods;
|
||||
uint64_t protocols;
|
||||
};
|
||||
|
||||
struct objc2_class {
|
||||
uint32_t isa;
|
||||
uint32_t super_class;
|
||||
uint32_t cache;
|
||||
uint32_t vtable;
|
||||
uint32_t data;
|
||||
};
|
||||
|
||||
struct objc2_class_64 {
|
||||
uint64_t isa;
|
||||
uint64_t super_class;
|
||||
uint64_t cache;
|
||||
uint64_t vtable;
|
||||
uint64_t data;
|
||||
};
|
||||
|
||||
struct objc2_class_data {
|
||||
uint32_t flags;
|
||||
uint32_t instance_start;
|
||||
uint32_t instance_size;
|
||||
uint32_t ivar_layout;
|
||||
uint32_t name;
|
||||
uint32_t base_methods;
|
||||
uint32_t base_protocols;
|
||||
uint32_t ivars;
|
||||
uint32_t weak_ivar_layout;
|
||||
uint32_t base_properties;
|
||||
};
|
||||
|
||||
struct objc2_class_data_64 {
|
||||
uint32_t flags;
|
||||
uint32_t instance_start;
|
||||
uint32_t instance_size;
|
||||
uint32_t reserved;
|
||||
uint64_t ivar_layout;
|
||||
uint64_t name;
|
||||
uint64_t base_methods;
|
||||
uint64_t base_protocols;
|
||||
uint64_t ivars;
|
||||
uint64_t weak_ivar_layout;
|
||||
uint64_t base_properties;
|
||||
};
|
||||
|
||||
struct objc2_method {
|
||||
uint32_t name;
|
||||
uint32_t types;
|
||||
uint32_t imp;
|
||||
};
|
||||
|
||||
struct objc2_method_64 {
|
||||
uint64_t name;
|
||||
uint64_t types;
|
||||
uint64_t imp;
|
||||
};
|
||||
|
||||
struct objc2_category {
|
||||
uint32_t name;
|
||||
uint32_t cls;
|
||||
uint32_t instance_methods;
|
||||
uint32_t class_methods;
|
||||
uint32_t protocols;
|
||||
uint32_t instance_properties;
|
||||
};
|
||||
|
||||
struct objc2_category_64 {
|
||||
uint64_t name;
|
||||
uint64_t cls;
|
||||
uint64_t instance_methods;
|
||||
uint64_t class_methods;
|
||||
uint64_t protocols;
|
||||
uint64_t instance_properties;
|
||||
};
|
||||
|
||||
struct objc2_protocol {
|
||||
uint32_t isa;
|
||||
uint32_t name;
|
||||
uint32_t protocols;
|
||||
uint32_t instance_methods;
|
||||
uint32_t class_methods;
|
||||
uint32_t optional_instance_methods;
|
||||
uint32_t optional_class_methods;
|
||||
uint32_t instance_properties;
|
||||
};
|
||||
|
||||
struct objc2_protocol_64 {
|
||||
uint64_t isa;
|
||||
uint64_t name;
|
||||
uint64_t protocols;
|
||||
uint64_t instance_methods;
|
||||
uint64_t class_methods;
|
||||
uint64_t optional_instance_methods;
|
||||
uint64_t optional_class_methods;
|
||||
uint64_t instance_properties;
|
||||
};
|
||||
|
||||
struct objc2_message {
|
||||
uint32_t imp;
|
||||
uint32_t name;
|
||||
};
|
||||
|
||||
struct objc2_message_64 {
|
||||
uint64_t imp;
|
||||
uint64_t name;
|
||||
};
|
||||
|
||||
class MacArchitecture;
|
||||
class MacSegment;
|
||||
|
||||
class IObjcMethod : public IObject
|
||||
{
|
||||
public:
|
||||
virtual uint64_t address() const = 0;
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcMethodList : public ObjectList<IObjcMethod>
|
||||
{
|
||||
public:
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcClass : public IObject
|
||||
{
|
||||
public:
|
||||
virtual uint64_t address() const = 0;
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcClassList : public ObjectList<IObjcClass>
|
||||
{
|
||||
public:
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcCategory : public IObject
|
||||
{
|
||||
public:
|
||||
virtual uint64_t address() const = 0;
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcCategoryList : public ObjectList<IObjcCategory>
|
||||
{
|
||||
public:
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcSelector : public IObject
|
||||
{
|
||||
public:
|
||||
virtual uint64_t address() const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcSelectorList : public ObjectList<IObjcSelector>
|
||||
{
|
||||
public:
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcProtocol : public IObject
|
||||
{
|
||||
public:
|
||||
virtual uint64_t address() const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcProtocolList : public ObjectList<IObjcProtocol>
|
||||
{
|
||||
public:
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
};
|
||||
|
||||
class IObjcStorage : public IObject
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromFile(MacArchitecture &file) = 0;
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const = 0;
|
||||
virtual std::vector<MacSegment *> segment_list() const = 0;
|
||||
};
|
||||
|
||||
class BaseObjcClass : public IObjcClass
|
||||
{
|
||||
public:
|
||||
BaseObjcClass(IObjcClassList *owner, uint64_t address);
|
||||
virtual ~BaseObjcClass();
|
||||
virtual uint64_t address() const { return address_; }
|
||||
private:
|
||||
IObjcClassList *owner_;
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class BaseObjcClassList : public IObjcClassList
|
||||
{
|
||||
public:
|
||||
virtual void AddObject(IObjcClass *object);
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
IObjcClass *GetClassByAddress(uint64_t address) const;
|
||||
private:
|
||||
std::map<uint64_t, IObjcClass *> map_;
|
||||
};
|
||||
|
||||
class BaseObjcMethod : public IObjcMethod
|
||||
{
|
||||
public:
|
||||
BaseObjcMethod(IObjcMethodList *owner, uint64_t address);
|
||||
virtual ~BaseObjcMethod();
|
||||
virtual uint64_t address() const { return address_; }
|
||||
private:
|
||||
IObjcMethodList *owner_;
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class BaseObjcMethodList : public IObjcMethodList
|
||||
{
|
||||
public:
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
};
|
||||
|
||||
class BaseObjcCategory : public IObjcCategory
|
||||
{
|
||||
public:
|
||||
BaseObjcCategory(IObjcCategoryList *owner, uint64_t address);
|
||||
virtual ~BaseObjcCategory();
|
||||
virtual uint64_t address() const { return address_; }
|
||||
private:
|
||||
IObjcCategoryList *owner_;
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class BaseObjcCategoryList : public IObjcCategoryList
|
||||
{
|
||||
public:
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
};
|
||||
|
||||
class BaseObjcSelector : public IObjcSelector
|
||||
{
|
||||
public:
|
||||
BaseObjcSelector(IObjcSelectorList *owner, uint64_t address);
|
||||
virtual ~BaseObjcSelector();
|
||||
virtual uint64_t address() const { return address_; }
|
||||
private:
|
||||
IObjcSelectorList *owner_;
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class BaseObjcSelectorList : public IObjcSelectorList
|
||||
{
|
||||
public:
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
};
|
||||
|
||||
class BaseObjcProtocol : public IObjcProtocol
|
||||
{
|
||||
public:
|
||||
BaseObjcProtocol(IObjcProtocolList *owner, uint64_t address);
|
||||
virtual ~BaseObjcProtocol();
|
||||
virtual uint64_t address() const { return address_; }
|
||||
private:
|
||||
IObjcProtocolList *owner_;
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class BaseObjcProtocolList : public IObjcProtocolList
|
||||
{
|
||||
public:
|
||||
IObjcProtocol *GetProtocolByAddress(uint64_t address) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
};
|
||||
|
||||
enum ObjcMethodType {
|
||||
mtUnknown,
|
||||
mtLoad
|
||||
};
|
||||
|
||||
class ObjcMethod : public BaseObjcMethod
|
||||
{
|
||||
public:
|
||||
ObjcMethod(IObjcMethodList *owner, uint64_t address);
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t name_;
|
||||
uint64_t types_;
|
||||
uint64_t imp_;
|
||||
ObjcMethodType type_;
|
||||
};
|
||||
|
||||
class ObjcMethodList : public BaseObjcMethodList
|
||||
{
|
||||
public:
|
||||
ObjcMethodList();
|
||||
ObjcMethod *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file, uint64_t address);
|
||||
private:
|
||||
ObjcMethod *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class ObjcClass : public BaseObjcClass
|
||||
{
|
||||
public:
|
||||
ObjcClass(IObjcClassList *owner, uint64_t address);
|
||||
~ObjcClass();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
uint64_t isa() const { return isa_; }
|
||||
uint64_t super_class() const { return super_class_; }
|
||||
uint64_t info() const { return info_; }
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t isa_;
|
||||
uint64_t super_class_;
|
||||
uint64_t name_;
|
||||
uint64_t version_;
|
||||
uint64_t info_;
|
||||
uint64_t instance_size_;
|
||||
uint64_t ivars_;
|
||||
uint64_t methods_;
|
||||
uint64_t cache_;
|
||||
uint64_t protocols_;
|
||||
ObjcMethodList *method_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ObjcClass(const ObjcClass &);
|
||||
ObjcClass &operator =(const ObjcClass &);
|
||||
};
|
||||
|
||||
class ObjcClassList : public BaseObjcClassList
|
||||
{
|
||||
public:
|
||||
ObjcClassList();
|
||||
ObjcClass *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file, size_t class_count);
|
||||
private:
|
||||
ObjcClass *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class ObjcCategory: public BaseObjcCategory
|
||||
{
|
||||
public:
|
||||
ObjcCategory(IObjcCategoryList *owner, uint64_t address);
|
||||
~ObjcCategory();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t category_name_;
|
||||
uint64_t class_name_;
|
||||
uint64_t instance_methods_;
|
||||
uint64_t class_methods_;
|
||||
uint64_t protocols_;
|
||||
ObjcMethodList *method_list_;
|
||||
ObjcMethodList *class_method_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ObjcCategory(const ObjcCategory &);
|
||||
ObjcCategory &operator =(const ObjcCategory &);
|
||||
};
|
||||
|
||||
class ObjcCategoryList : public BaseObjcCategoryList
|
||||
{
|
||||
public:
|
||||
ObjcCategoryList();
|
||||
ObjcCategory *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file, size_t category_count);
|
||||
private:
|
||||
ObjcCategory *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class ObjcSelector : public BaseObjcSelector
|
||||
{
|
||||
public:
|
||||
ObjcSelector(IObjcSelectorList *owner, uint64_t address);
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
};
|
||||
|
||||
class ObjcSelectorList : public BaseObjcSelectorList
|
||||
{
|
||||
public:
|
||||
ObjcSelectorList();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
private:
|
||||
ObjcSelector *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class ObjcProtocolList;
|
||||
|
||||
class ObjcProtocol : public BaseObjcProtocol
|
||||
{
|
||||
public:
|
||||
ObjcProtocol(ObjcProtocolList *owner, uint64_t address);
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t isa_;
|
||||
uint64_t name_;
|
||||
uint64_t protocols_;
|
||||
uint64_t instance_methods_;
|
||||
uint64_t class_methods_;
|
||||
};
|
||||
|
||||
class ObjcProtocolList : public BaseObjcProtocolList
|
||||
{
|
||||
public:
|
||||
ObjcProtocolList();
|
||||
ObjcProtocol *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
private:
|
||||
ObjcProtocol *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class ObjcStorage : public IObjcStorage
|
||||
{
|
||||
public:
|
||||
ObjcStorage();
|
||||
~ObjcStorage();
|
||||
virtual void ReadFromFile(MacArchitecture &file);
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual std::vector<MacSegment *> segment_list() const { return segment_list_; }
|
||||
private:
|
||||
ObjcClassList *class_list_;
|
||||
ObjcCategoryList *category_list_;
|
||||
ObjcSelectorList *selector_list_;
|
||||
ObjcProtocolList *protocol_list_;
|
||||
std::vector<MacSegment *> segment_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
ObjcStorage(const ObjcStorage &);
|
||||
ObjcStorage &operator =(const ObjcStorage &);
|
||||
};
|
||||
|
||||
class Objc2Method : public BaseObjcMethod
|
||||
{
|
||||
public:
|
||||
Objc2Method(IObjcMethodList *owner, uint64_t address);
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t name_;
|
||||
uint64_t types_;
|
||||
uint64_t imp_;
|
||||
ObjcMethodType type_;
|
||||
};
|
||||
|
||||
class Objc2MethodList : public BaseObjcMethodList
|
||||
{
|
||||
public:
|
||||
Objc2MethodList();
|
||||
Objc2Method *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file, uint64_t address);
|
||||
private:
|
||||
Objc2Method *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2Class : public BaseObjcClass
|
||||
{
|
||||
public:
|
||||
Objc2Class(IObjcClassList *owner, uint64_t address);
|
||||
~Objc2Class();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
uint64_t isa() const { return isa_; }
|
||||
uint64_t super_class() const { return super_class_; }
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t isa_;
|
||||
uint64_t super_class_;
|
||||
uint64_t cache_;
|
||||
uint64_t vtable_;
|
||||
uint64_t data_;
|
||||
uint32_t flags_;
|
||||
uint32_t instance_start_;
|
||||
uint32_t instance_size_;
|
||||
uint64_t ivar_layout_;
|
||||
uint64_t name_;
|
||||
uint64_t base_methods_;
|
||||
uint64_t base_protocols_;
|
||||
uint64_t ivars_;
|
||||
uint64_t protocols_;
|
||||
uint64_t weak_ivar_layout_;
|
||||
uint64_t base_properties_;
|
||||
Objc2MethodList *method_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Objc2Class(const Objc2Class &);
|
||||
Objc2Class &operator =(const Objc2Class &);
|
||||
};
|
||||
|
||||
class Objc2ClassList : public BaseObjcClassList
|
||||
{
|
||||
public:
|
||||
Objc2ClassList();
|
||||
Objc2Class *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
private:
|
||||
Objc2Class *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2Category: public BaseObjcCategory
|
||||
{
|
||||
public:
|
||||
Objc2Category(IObjcCategoryList *owner, uint64_t address);
|
||||
~Objc2Category();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t name_;
|
||||
uint64_t cls_;
|
||||
uint64_t instance_methods_;
|
||||
uint64_t class_methods_;
|
||||
uint64_t protocols_;
|
||||
uint64_t instance_properties_;
|
||||
Objc2MethodList *method_list_;
|
||||
Objc2MethodList *class_method_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Objc2Category(const Objc2Category &);
|
||||
Objc2Category &operator =(const Objc2Category &);
|
||||
};
|
||||
|
||||
class Objc2CategoryList : public BaseObjcCategoryList
|
||||
{
|
||||
public:
|
||||
Objc2CategoryList();
|
||||
Objc2Category *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
private:
|
||||
Objc2Category *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2SelectorList : public BaseObjcSelectorList
|
||||
{
|
||||
public:
|
||||
Objc2SelectorList();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
private:
|
||||
ObjcSelector *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2ProtocolList;
|
||||
|
||||
class Objc2Protocol : public BaseObjcProtocol
|
||||
{
|
||||
public:
|
||||
Objc2Protocol(Objc2ProtocolList *owner, uint64_t address);
|
||||
~Objc2Protocol();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
OperandSize size_;
|
||||
uint64_t isa_;
|
||||
uint64_t name_;
|
||||
uint64_t protocols_;
|
||||
uint64_t instance_methods_;
|
||||
uint64_t class_methods_;
|
||||
uint64_t optional_instance_methods_;
|
||||
uint64_t optional_class_methods_;
|
||||
uint64_t instance_properties_;
|
||||
Objc2MethodList *method_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Objc2Protocol(const Objc2Protocol &);
|
||||
Objc2Protocol &operator =(const Objc2Protocol &);
|
||||
};
|
||||
|
||||
class Objc2ProtocolList : public BaseObjcProtocolList
|
||||
{
|
||||
public:
|
||||
Objc2ProtocolList();
|
||||
Objc2Protocol *item(size_t index) const;
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
Objc2Protocol *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2MessageList;
|
||||
|
||||
class Objc2Message : public IObject
|
||||
{
|
||||
public:
|
||||
Objc2Message(Objc2MessageList *owner, uint64_t address);
|
||||
~Objc2Message();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
Objc2MessageList *owner_;
|
||||
uint64_t address_;
|
||||
OperandSize size_;
|
||||
uint64_t imp_;
|
||||
uint64_t name_;
|
||||
};
|
||||
|
||||
class Objc2MessageList : public ObjectList<Objc2Message>
|
||||
{
|
||||
public:
|
||||
Objc2MessageList();
|
||||
void ReadFromFile(MacArchitecture &file);
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
private:
|
||||
Objc2Message *Add(uint64_t address);
|
||||
};
|
||||
|
||||
class Objc2Storage : public IObjcStorage
|
||||
{
|
||||
public:
|
||||
Objc2Storage();
|
||||
~Objc2Storage();
|
||||
virtual void ReadFromFile(MacArchitecture &file);
|
||||
virtual void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
virtual std::vector<MacSegment *> segment_list() const { return segment_list_; }
|
||||
private:
|
||||
Objc2ClassList *class_list_;
|
||||
Objc2CategoryList *category_list_;
|
||||
Objc2SelectorList *selector_list_;
|
||||
Objc2ProtocolList *protocol_list_;
|
||||
Objc2MessageList *message_list_;
|
||||
std::vector<MacSegment *> segment_list_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Objc2Storage(const Objc2Storage &);
|
||||
Objc2Storage &operator =(const Objc2Storage &);
|
||||
};
|
||||
|
||||
class Objc : public IObject
|
||||
{
|
||||
public:
|
||||
Objc();
|
||||
~Objc();
|
||||
bool ReadFromFile(MacArchitecture &file);
|
||||
void GetLoadMethodReferences(std::set<uint64_t> &address_list) const;
|
||||
void GetStringReferences(std::set<uint64_t> &address_list) const;
|
||||
std::vector<MacSegment *> segment_list() const;
|
||||
private:
|
||||
IObjcStorage *storage_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
Objc(const Objc &);
|
||||
Objc &operator =(const Objc &);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Support of object hierarchy.
|
||||
*/
|
||||
|
||||
#include "objects.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _vsnprintf_s(dest, dest_sz, cnt, fmt, args) _vsnprintf((dest), (dest_sz), (fmt), (args))
|
||||
#endif // __APPLE__
|
||||
|
||||
std::string string_format(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int size = 100;
|
||||
std::string res;
|
||||
for (;;) {
|
||||
res.resize(size);
|
||||
va_start(args, format);
|
||||
int n = _vsnprintf_s(&res[0], size, _TRUNCATE, format, args);
|
||||
if (n > -1 && n < size) {
|
||||
res.resize(n);
|
||||
break;
|
||||
}
|
||||
if (n > -1)
|
||||
size = n + 1;
|
||||
else
|
||||
size *= 2;
|
||||
}
|
||||
va_end(args);
|
||||
return res;
|
||||
}
|
||||
|
||||
int AddressableObject::CompareWith(const AddressableObject &other) const
|
||||
{
|
||||
if (address_ > other.address_) return 1;
|
||||
if (address_ < other.address_) return -1;
|
||||
return 0;
|
||||
}
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* Support of object hierarchy.
|
||||
*/
|
||||
|
||||
#ifndef OBJECTS_H
|
||||
#define OBJECTS_H
|
||||
|
||||
std::string string_format(const char *format, ...);
|
||||
|
||||
// TODO: find more appropriate place for {
|
||||
enum OperandSize : uint8_t {
|
||||
osByte,
|
||||
osWord,
|
||||
osDWord,
|
||||
osQWord,
|
||||
osTByte,
|
||||
osOWord,
|
||||
osXMMWord,
|
||||
osYMMWord,
|
||||
osFWord,
|
||||
osDefault = 0xff
|
||||
};
|
||||
|
||||
enum MessageType {
|
||||
mtInformation,
|
||||
mtWarning,
|
||||
mtError,
|
||||
mtAdded,
|
||||
mtChanged,
|
||||
mtDeleted,
|
||||
mtScript,
|
||||
};
|
||||
// }
|
||||
|
||||
class IObject
|
||||
{
|
||||
public:
|
||||
virtual ~IObject() {}
|
||||
virtual int CompareWith(const IObject &) const { throw std::runtime_error("Abstract method"); }
|
||||
};
|
||||
|
||||
class AddressableObject : public IObject
|
||||
{
|
||||
public:
|
||||
AddressableObject() : address_(0) {}
|
||||
AddressableObject(const AddressableObject &src) : address_(src.address_) {}
|
||||
AddressableObject &operator=(const AddressableObject &src) { address_ = src.address_; return *this; }
|
||||
|
||||
using IObject::CompareWith;
|
||||
int CompareWith(const AddressableObject &other) const;
|
||||
uint64_t address() const { return address_; }
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
|
||||
protected:
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
template <typename Object>
|
||||
class ObjectList : public IObject
|
||||
{
|
||||
//not implemented
|
||||
ObjectList &operator=(const ObjectList &);
|
||||
public:
|
||||
explicit ObjectList() : IObject() {}
|
||||
explicit ObjectList(const ObjectList &src) : IObject(src) {}
|
||||
virtual ~ObjectList() { clear(); }
|
||||
virtual void clear()
|
||||
{
|
||||
while (!v_.empty()) {
|
||||
delete v_.back();
|
||||
}
|
||||
}
|
||||
void Delete(size_t index)
|
||||
{
|
||||
if (index >= v_.size())
|
||||
throw std::runtime_error("subscript out of range");
|
||||
delete v_[index];
|
||||
}
|
||||
size_t count() const { return v_.size(); }
|
||||
Object *item(size_t index) const
|
||||
{
|
||||
if (index >= v_.size())
|
||||
throw std::runtime_error("subscript out of range");
|
||||
return v_[index];
|
||||
}
|
||||
void resize(size_t size) {
|
||||
v_.resize(size);
|
||||
}
|
||||
Object *last() const { return v_.empty() ? NULL : *v_.rbegin(); }
|
||||
static bool CompareObjects(const Object *obj1, const Object *obj2) { return obj1->CompareWith(*obj2) < 0; }
|
||||
void Sort() { std::sort(v_.begin(), v_.end(), CompareObjects); }
|
||||
typedef typename std::vector<Object*>::const_iterator const_iterator;
|
||||
typedef typename std::vector<Object*>::iterator iterator;
|
||||
size_t IndexOf(const Object *obj) const
|
||||
{
|
||||
const_iterator it = std::find(v_.begin(), v_.end(), obj);
|
||||
return (it == v_.end()) ? -1 : it - v_.begin();
|
||||
}
|
||||
|
||||
size_t IndexOf(const Object *obj, size_t index) const
|
||||
{
|
||||
const_iterator it = std::find((v_.begin()+index), v_.end(), obj);
|
||||
return (it == v_.end()) ? -1 : it - v_.begin();
|
||||
}
|
||||
void SwapObjects(size_t i, size_t j) { std::swap(v_[i], v_[j]); }
|
||||
virtual void AddObject(Object *obj) { v_.push_back(obj); }
|
||||
virtual void InsertObject(size_t index, Object *obj) { v_.insert(v_.begin() + index, obj); }
|
||||
virtual void RemoveObject(Object *obj)
|
||||
{
|
||||
for (size_t i = count(); i > 0; i--) {
|
||||
if (item(i - 1) == obj) {
|
||||
erase(i - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void erase(size_t index) { v_.erase(v_.begin() + index); }
|
||||
void assign(const std::list<Object*> &src)
|
||||
{
|
||||
v_.clear();
|
||||
for (typename std::list<Object*>::const_iterator it = src.begin(); it != src.end(); it++) {
|
||||
v_.push_back(*it);
|
||||
}
|
||||
}
|
||||
|
||||
const_iterator begin() const { return v_.begin(); }
|
||||
const_iterator end() const { return v_.end(); }
|
||||
|
||||
iterator _begin() { return v_.begin(); }
|
||||
iterator _end() { return v_.end(); }
|
||||
|
||||
protected:
|
||||
void Reserve(size_t count) { v_.reserve(count); }
|
||||
std::vector<Object*> v_;
|
||||
};
|
||||
|
||||
class Data
|
||||
{
|
||||
public:
|
||||
Data() {}
|
||||
Data(const std::vector<uint8_t> &src) { m_vData = src; }
|
||||
void PushByte(uint8_t value) { m_vData.push_back(value); }
|
||||
void PushDWord(uint32_t value) { PushBuff(&value, sizeof(value)); }
|
||||
void PushQWord(uint64_t value) { PushBuff(&value, sizeof(value)); }
|
||||
void PushWord(uint16_t value) { PushBuff(&value, sizeof(value)); }
|
||||
void PushBuff(const void *value, size_t nCount) { m_vData.insert(m_vData.end(), reinterpret_cast<const uint8_t *>(value), reinterpret_cast<const uint8_t *>(value) + nCount); }
|
||||
void InsertByte(size_t pos, uint8_t value) { m_vData.insert(m_vData.begin() + pos, value); }
|
||||
void InsertBuff(size_t pos, const void *buff, size_t nCount) { m_vData.insert(m_vData.begin() + pos, reinterpret_cast<const uint8_t *>(buff), reinterpret_cast<const uint8_t *>(buff) + nCount); }
|
||||
uint32_t ReadDWord(size_t nPosition) const { return *reinterpret_cast<const uint32_t *>(&m_vData[nPosition]); }
|
||||
void WriteDWord(size_t nPosition, uint32_t dwValue) { *reinterpret_cast<uint32_t *>(&m_vData[nPosition]) = dwValue; }
|
||||
size_t size() const { return m_vData.size(); }
|
||||
void clear() { m_vData.clear(); }
|
||||
bool empty() const { return m_vData.empty(); }
|
||||
void resize(size_t size) { m_vData.resize(size); }
|
||||
void resize(size_t size, uint8_t value) { m_vData.resize(size, value); }
|
||||
const uint8_t *data() const { return m_vData.data(); }
|
||||
const uint8_t &operator[](size_t pos) const
|
||||
{
|
||||
if (pos >= m_vData.size())
|
||||
throw std::runtime_error("subscript out of range");
|
||||
return m_vData[pos];
|
||||
}
|
||||
uint8_t &operator[](size_t pos)
|
||||
{
|
||||
if (pos >= m_vData.size())
|
||||
throw std::runtime_error("subscript out of range");
|
||||
return m_vData[pos];
|
||||
}
|
||||
bool operator < (const Data &right) const
|
||||
{
|
||||
return (size() != right.size()) ? (size() < right.size()) : (memcmp(data(), right.data(), size()) < 0);
|
||||
}
|
||||
private:
|
||||
std::vector<uint8_t> m_vData;
|
||||
};
|
||||
|
||||
class canceled_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit canceled_error(const std::string &message)
|
||||
: runtime_error(message) {}
|
||||
};
|
||||
|
||||
class abort_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit abort_error(const std::string &message)
|
||||
: runtime_error(message) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
+2204
File diff suppressed because it is too large
Load Diff
+111
@@ -0,0 +1,111 @@
|
||||
#ifndef OSUTILS_H
|
||||
#define OSUTILS_H
|
||||
|
||||
/**
|
||||
* Flags for opening files.
|
||||
*/
|
||||
|
||||
enum FileMode
|
||||
{
|
||||
fmOpenRead = 0x0000,
|
||||
fmOpenWrite = 0x0001,
|
||||
fmOpenReadWrite = 0x0002,
|
||||
fmShareExclusive = 0x0010,
|
||||
fmShareDenyWrite = 0x0020,
|
||||
fmShareDenyRead = 0x0030,
|
||||
fmShareDenyNone = 0x0040,
|
||||
fmCreate = 0x0100
|
||||
};
|
||||
|
||||
enum SeekOrigin
|
||||
{
|
||||
soBeginning,
|
||||
soCurrent,
|
||||
soEnd
|
||||
};
|
||||
|
||||
struct PROCESS_ITEM {
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct MODULE_ITEM {
|
||||
HMODULE handle;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct MODULE_INFO {
|
||||
void *address;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct SYSTEM_TIME {
|
||||
uint16_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
};
|
||||
|
||||
namespace os
|
||||
{
|
||||
unicode_string FromUTF8(const std::string &src);
|
||||
std::string ToUTF8(const unicode_string &src);
|
||||
#ifndef VMP_GNU
|
||||
std::string ToOEM(const unicode_string &src);
|
||||
unicode_string FromACP(const std::string &src);
|
||||
bool ValidateUTF8(const std::string &src);
|
||||
#endif
|
||||
std::string ExtractFilePath(const char *name);
|
||||
std::string ExtractFileName(const char *name);
|
||||
std::string ExtractFileExt(const char *name);
|
||||
std::string CombinePaths(const char *path, const char *file_name);
|
||||
std::string SubtractPath(const char *path, const char *file_name);
|
||||
std::string ChangeFileExt(const char *name, const char *ext);
|
||||
std::string GetCurrentPath();
|
||||
std::string GetExecutablePath();
|
||||
std::string GetTempFilePathName(const char *pathname_template = NULL);
|
||||
std::string GetTempFilePathNameFor(const char *pathname);
|
||||
bool FileExists(const char *name);
|
||||
bool FileDelete(const char *name, bool toRecycleBin = false);
|
||||
bool FileCopy(const char *src, const char *dest);
|
||||
|
||||
HANDLE FileCreate(const char *file_name, uint32_t mode);
|
||||
bool FileClose(HANDLE h);
|
||||
size_t FileRead(HANDLE h, void *buf, size_t size);
|
||||
size_t FileWrite(HANDLE h, const void *buf, size_t size);
|
||||
uint64_t FileSeek(HANDLE h, uint64_t offset, SeekOrigin origin);
|
||||
bool FileSetEnd(HANDLE h);
|
||||
bool FileGetCheckSum(const char *file_name, uint32_t *check_sum);
|
||||
void Print(const char *text);
|
||||
std::vector<std::string> CommandLine();
|
||||
std::vector<std::string> FindFiles(const char *path, const char *mask, bool only_directories = false);
|
||||
uint32_t GetTickCount();
|
||||
bool WriteIniString(const char *section, const char *key, const char *value, const char *file_name);
|
||||
std::string ReadIniString(const char *section, const char *key, const char *default_value, const char *file_name);
|
||||
HPROCESS ProcessOpen(uint32_t process_id);
|
||||
bool ProcessClose(HPROCESS h);
|
||||
size_t ProcessRead(HPROCESS h, void *base_address, void *buf, size_t size);
|
||||
size_t ProcessWrite(HPROCESS h, void *base_address, const void *buf, size_t size);
|
||||
uint64_t GetLastWriteTime(const char *name);
|
||||
std::vector<PROCESS_ITEM> EnumProcesses();
|
||||
std::vector<MODULE_ITEM> EnumModules(uint32_t process_id);
|
||||
bool GetModuleInformation(HANDLE process, HMODULE module, MODULE_INFO *info, size_t size);
|
||||
std::string GetSysAppDataDirectory();
|
||||
std::string CombineThisAppDataDirectory(const char *lastPathPart);
|
||||
bool PathCreate(const char *name);
|
||||
std::string GetLocaleName(const char *code);
|
||||
std::string GetCurrentLocale();
|
||||
void GetLocalTime(SYSTEM_TIME *res);
|
||||
bool FileMove(const char *oldName, const char *newName);
|
||||
#ifdef __APPLE__
|
||||
std::string GetMainExeFileName(const char *file_name);
|
||||
#endif
|
||||
HMODULE LibraryOpen(const std::string &name);
|
||||
bool LibraryClose(HMODULE h);
|
||||
void *GetFunction(HMODULE h, const std::string &name);
|
||||
std::string ExpandEnvironmentVariables(const char *path);
|
||||
std::string GetEnvironmentVariable(const char *name);
|
||||
void SetEnvironmentVariable(const char *name, const char *value);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
#include "../third-party/lzma/Alloc.h"
|
||||
#include "objects.h"
|
||||
#include "files.h"
|
||||
#include "packer.h"
|
||||
|
||||
/**
|
||||
* PackerInStream
|
||||
*/
|
||||
|
||||
static SRes ReadFromStream(void *object, void *data, size_t *size)
|
||||
{
|
||||
PackerInputStream *p = reinterpret_cast<PackerInputStream *>(object);
|
||||
size_t read_size = (*size < p->size - p->pos) ? *size : p->size - p->pos;
|
||||
if (read_size) {
|
||||
read_size = p->file->Read(data, read_size);
|
||||
p->pos += read_size;
|
||||
}
|
||||
*size = read_size;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
PackerInputStream::PackerInputStream(IArchitecture *file_, size_t size_)
|
||||
: file(file_), data(NULL), size(size_), pos(0)
|
||||
{
|
||||
p.Read = ReadFromStream;
|
||||
}
|
||||
|
||||
static SRes ReadFromData(void *object, void *data, size_t *size)
|
||||
{
|
||||
PackerInputStream *p = reinterpret_cast<PackerInputStream *>(object);
|
||||
size_t read_size = (*size < p->size - p->pos) ? *size : p->size - p->pos;
|
||||
if (read_size) {
|
||||
memcpy(data, p->data->data() + p->pos, read_size);
|
||||
p->pos += read_size;
|
||||
}
|
||||
*size = read_size;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
PackerInputStream::PackerInputStream(Data *data_)
|
||||
: file(NULL), data(data_), size(data_->size()), pos(0)
|
||||
{
|
||||
p.Read = ReadFromData;
|
||||
}
|
||||
|
||||
/**
|
||||
* PackerOutStream
|
||||
*/
|
||||
|
||||
static size_t WriteToStream(void *object, const void *data, size_t size)
|
||||
{
|
||||
PackerOutputStream *p = reinterpret_cast<PackerOutputStream *>(object);
|
||||
p->data->PushBuff(data, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
PackerOutputStream::PackerOutputStream(Data *data_)
|
||||
: data(data_)
|
||||
{
|
||||
p.Write = WriteToStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* PackerProgress
|
||||
*/
|
||||
|
||||
SRes PackProgress(void *object, UInt64 inSize, UInt64 /*outSize*/)
|
||||
{
|
||||
PackerProgress *p = reinterpret_cast<PackerProgress *>(object);
|
||||
if (p->file)
|
||||
p->file->StepProgress(inSize - p->last_pos);
|
||||
p->last_pos = inSize;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
PackerProgress::PackerProgress(IArchitecture *file_)
|
||||
: file(file_), last_pos(0)
|
||||
{
|
||||
p.Progress = PackProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Packer
|
||||
*/
|
||||
|
||||
Packer::Packer()
|
||||
{
|
||||
encoder_ = LzmaEnc_Create(&g_Alloc);
|
||||
if (encoder_ == 0)
|
||||
throw 1;
|
||||
|
||||
LzmaEncProps_Init(&props_);
|
||||
props_.level = 9;
|
||||
props_.writeEndMark = true;
|
||||
props_.dictSize = 1 << 24;
|
||||
if (LzmaEnc_SetProps(encoder_, &props_) != SZ_OK)
|
||||
throw 1;
|
||||
}
|
||||
|
||||
Packer::~Packer()
|
||||
{
|
||||
if (encoder_ != 0)
|
||||
LzmaEnc_Destroy(encoder_, &g_Alloc, &g_BigAlloc);
|
||||
}
|
||||
|
||||
bool Packer::WriteProps(Data *data)
|
||||
{
|
||||
data->clear();
|
||||
|
||||
Byte props_buff[LZMA_PROPS_SIZE];
|
||||
size_t props_size = sizeof(props_buff);
|
||||
if (LzmaEnc_WriteProperties(encoder_, props_buff, &props_size) != SZ_OK)
|
||||
return false;
|
||||
data->PushBuff(props_buff, props_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Packer::Code(IArchitecture *file, PackerInputStream &in, PackerOutputStream &out)
|
||||
{
|
||||
out.data->clear();
|
||||
|
||||
PackerProgress progress(file);
|
||||
if (LzmaEnc_Encode(encoder_, &out.p, &in.p, &progress.p, &g_Alloc, &g_BigAlloc) != SZ_OK)
|
||||
return false;
|
||||
|
||||
// LzmaEnc_Encode never calls last progress
|
||||
file->StepProgress(in.size - progress.last_pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Packer::Code(IArchitecture *file, Data *in_data, Data *out_data)
|
||||
{
|
||||
PackerInputStream in(in_data);
|
||||
PackerOutputStream out(out_data);
|
||||
|
||||
return Code(file, in, out);
|
||||
}
|
||||
|
||||
bool Packer::Code(IArchitecture *file, size_t size, Data *data)
|
||||
{
|
||||
PackerInputStream in(file, size);
|
||||
PackerOutputStream out(data);
|
||||
|
||||
return Code(file, in, out);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef PACKER_H
|
||||
#define PACKER_H
|
||||
|
||||
#include "../third-party/lzma/LzmaEnc.h"
|
||||
|
||||
class IArchitecture;
|
||||
|
||||
struct PackerInputStream
|
||||
{
|
||||
ISeqInStream p;
|
||||
IArchitecture *file;
|
||||
Data *data;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
PackerInputStream(IArchitecture *file_, size_t size_);
|
||||
PackerInputStream(Data *data_);
|
||||
};
|
||||
|
||||
struct PackerOutputStream
|
||||
{
|
||||
ISeqOutStream p;
|
||||
Data *data;
|
||||
PackerOutputStream(Data *data_);
|
||||
};
|
||||
|
||||
struct PackerProgress
|
||||
{
|
||||
ICompressProgress p;
|
||||
IArchitecture *file;
|
||||
uint64_t last_pos;
|
||||
PackerProgress(IArchitecture *file_);
|
||||
};
|
||||
|
||||
class Packer
|
||||
{
|
||||
public:
|
||||
Packer();
|
||||
~Packer();
|
||||
bool Code(IArchitecture *file, size_t size, Data *data);
|
||||
bool Code(IArchitecture *file, Data *in_data, Data *out_data);
|
||||
bool WriteProps(Data *data);
|
||||
private:
|
||||
bool Code(IArchitecture *file, PackerInputStream &in, PackerOutputStream &out);
|
||||
|
||||
CLzmaEncHandle encoder_;
|
||||
CLzmaEncProps props_;
|
||||
};
|
||||
|
||||
#endif
|
||||
+2407
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,880 @@
|
||||
/**
|
||||
* PE format.
|
||||
*/
|
||||
|
||||
#ifndef PE_H
|
||||
#define PE_H
|
||||
|
||||
#ifdef VMP_GNU
|
||||
|
||||
#define DLL_PROCESS_ATTACH 1
|
||||
#define DLL_THREAD_ATTACH 2
|
||||
#define DLL_THREAD_DETACH 3
|
||||
#define DLL_PROCESS_DETACH 0
|
||||
|
||||
#define READ_NAME(de) (*(DWORD *)&de)
|
||||
#define READ_OFFSETTODATA(de) (*(((DWORD *)&de) + 1))
|
||||
#define READ_ID(de) (*(WORD *)&de)
|
||||
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E // NE
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
|
||||
#define IMAGE_VXD_SIGNATURE 0x454C // LE
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
|
||||
WORD e_magic; // Magic number
|
||||
WORD e_cblp; // Bytes on last page of file
|
||||
WORD e_cp; // Pages in file
|
||||
WORD e_crlc; // Relocations
|
||||
WORD e_cparhdr; // Size of header in paragraphs
|
||||
WORD e_minalloc; // Minimum extra paragraphs needed
|
||||
WORD e_maxalloc; // Maximum extra paragraphs needed
|
||||
WORD e_ss; // Initial (relative) SS value
|
||||
WORD e_sp; // Initial SP value
|
||||
WORD e_csum; // Checksum
|
||||
WORD e_ip; // Initial IP value
|
||||
WORD e_cs; // Initial (relative) CS value
|
||||
WORD e_lfarlc; // File address of relocation table
|
||||
WORD e_ovno; // Overlay number
|
||||
WORD e_res[4]; // Reserved words
|
||||
WORD e_oemid; // OEM identifier (for e_oeminfo)
|
||||
WORD e_oeminfo; // OEM information; e_oemid specific
|
||||
WORD e_res2[10]; // Reserved words
|
||||
LONG e_lfanew; // File address of new exe header
|
||||
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
||||
|
||||
typedef struct tagVS_FIXEDFILEINFO {
|
||||
DWORD dwSignature; /* e.g. 0xfeef04bd */
|
||||
DWORD dwStrucVersion; /* e.g. 0x00000042 = "0.42" */
|
||||
DWORD dwFileVersionMS; /* e.g. 0x00030075 = "3.75" */
|
||||
DWORD dwFileVersionLS; /* e.g. 0x00000031 = "0.31" */
|
||||
DWORD dwProductVersionMS; /* e.g. 0x00030010 = "3.10" */
|
||||
DWORD dwProductVersionLS; /* e.g. 0x00000031 = "0.31" */
|
||||
DWORD dwFileFlagsMask; /* = 0x3F for version "0.42" */
|
||||
DWORD dwFileFlags; /* e.g. VFF_DEBUG | VFF_PRERELEASE */
|
||||
DWORD dwFileOS; /* e.g. VOS_DOS_WINDOWS16 */
|
||||
DWORD dwFileType; /* e.g. VFT_DRIVER */
|
||||
DWORD dwFileSubtype; /* e.g. VFT2_DRV_KEYBOARD */
|
||||
DWORD dwFileDateMS; /* e.g. 0 */
|
||||
DWORD dwFileDateLS; /* e.g. 0 */
|
||||
} VS_FIXEDFILEINFO;
|
||||
|
||||
//
|
||||
// Directory format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_DATA_DIRECTORY {
|
||||
DWORD VirtualAddress;
|
||||
DWORD Size;
|
||||
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
//
|
||||
// File header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_FILE_HEADER {
|
||||
WORD Machine;
|
||||
WORD NumberOfSections;
|
||||
DWORD TimeDateStamp;
|
||||
DWORD PointerToSymbolTable;
|
||||
DWORD NumberOfSymbols;
|
||||
WORD SizeOfOptionalHeader;
|
||||
WORD Characteristics;
|
||||
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
||||
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 // Agressively trim working set
|
||||
#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 // App can handle >2gb addresses
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
|
||||
#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 // If Image is on removable media, copy and run from the swap file.
|
||||
#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 // If Image is on Net, copy and run from the swap file.
|
||||
#define IMAGE_FILE_SYSTEM 0x1000 // System File.
|
||||
#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
|
||||
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 // File should only be run on a UP machine
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
|
||||
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I386 0x014c // Intel 386.
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x0162 // MIPS little-endian, 0x160 big-endian
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x0166 // MIPS little-endian
|
||||
#define IMAGE_FILE_MACHINE_R10000 0x0168 // MIPS little-endian
|
||||
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 // MIPS little-endian WCE v2
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x0184 // Alpha_AXP
|
||||
#define IMAGE_FILE_MACHINE_SH3 0x01a2 // SH3 little-endian
|
||||
#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
|
||||
#define IMAGE_FILE_MACHINE_SH3E 0x01a4 // SH3E little-endian
|
||||
#define IMAGE_FILE_MACHINE_SH4 0x01a6 // SH4 little-endian
|
||||
#define IMAGE_FILE_MACHINE_SH5 0x01a8 // SH5
|
||||
#define IMAGE_FILE_MACHINE_ARM 0x01c0 // ARM Little-Endian
|
||||
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
|
||||
#define IMAGE_FILE_MACHINE_AM33 0x01d3
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x01F0 // IBM PowerPC Little-Endian
|
||||
#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
|
||||
#define IMAGE_FILE_MACHINE_IA64 0x0200 // Intel 64
|
||||
#define IMAGE_FILE_MACHINE_MIPS16 0x0266 // MIPS
|
||||
#define IMAGE_FILE_MACHINE_ALPHA64 0x0284 // ALPHA64
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 // MIPS
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 // MIPS
|
||||
#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
|
||||
#define IMAGE_FILE_MACHINE_TRICORE 0x0520 // Infineon
|
||||
#define IMAGE_FILE_MACHINE_CEF 0x0CEF
|
||||
#define IMAGE_FILE_MACHINE_EBC 0x0EBC // EFI Byte Code
|
||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8)
|
||||
#define IMAGE_FILE_MACHINE_M32R 0x9041 // M32R little-endian
|
||||
#define IMAGE_FILE_MACHINE_CEE 0xC0EE
|
||||
|
||||
// Subsystem Values
|
||||
|
||||
#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
|
||||
#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image runs in the Posix character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 // image is a native Win9x driver.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 // Image runs in the Windows CE subsystem.
|
||||
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 //
|
||||
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 //
|
||||
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 //
|
||||
#define IMAGE_SUBSYSTEM_EFI_ROM 13
|
||||
#define IMAGE_SUBSYSTEM_XBOX 14
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
|
||||
|
||||
// DllCharacteristics Entries
|
||||
|
||||
// IMAGE_LIBRARY_PROCESS_INIT 0x0001 // Reserved.
|
||||
// IMAGE_LIBRARY_PROCESS_TERM 0x0002 // Reserved.
|
||||
// IMAGE_LIBRARY_THREAD_INIT 0x0004 // Reserved.
|
||||
// IMAGE_LIBRARY_THREAD_TERM 0x0008 // Reserved.
|
||||
#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040 // DLL can move.
|
||||
#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080 // Code Integrity Image
|
||||
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100 // Image is NX compatible
|
||||
#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 // Image understands isolation and doesn't want it
|
||||
#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 // Image does not use SEH. No SE handler may reside in this image
|
||||
#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 // Do not bind this image.
|
||||
// 0x1000 // Reserved.
|
||||
#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 // Driver uses WDM model
|
||||
// 0x4000 // Reserved
|
||||
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
|
||||
|
||||
// Directory Entries
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
|
||||
// IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // (X86 usage)
|
||||
#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 // Architecture Specific Data
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // RVA of GP
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 // Bound Import Directory in headers
|
||||
#define IMAGE_DIRECTORY_ENTRY_IAT 12 // Import Address Table
|
||||
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 // Delay Load Import Descriptors
|
||||
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 // COM Runtime descriptor
|
||||
|
||||
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||
|
||||
//
|
||||
// Optional header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_OPTIONAL_HEADER32 {
|
||||
//
|
||||
// Standard fields.
|
||||
//
|
||||
|
||||
WORD Magic;
|
||||
BYTE MajorLinkerVersion;
|
||||
BYTE MinorLinkerVersion;
|
||||
DWORD SizeOfCode;
|
||||
DWORD SizeOfInitializedData;
|
||||
DWORD SizeOfUninitializedData;
|
||||
DWORD AddressOfEntryPoint;
|
||||
DWORD BaseOfCode;
|
||||
DWORD BaseOfData;
|
||||
|
||||
//
|
||||
// NT additional fields.
|
||||
//
|
||||
|
||||
DWORD ImageBase;
|
||||
DWORD SectionAlignment;
|
||||
DWORD FileAlignment;
|
||||
WORD MajorOperatingSystemVersion;
|
||||
WORD MinorOperatingSystemVersion;
|
||||
WORD MajorImageVersion;
|
||||
WORD MinorImageVersion;
|
||||
WORD MajorSubsystemVersion;
|
||||
WORD MinorSubsystemVersion;
|
||||
DWORD Win32VersionValue;
|
||||
DWORD SizeOfImage;
|
||||
DWORD SizeOfHeaders;
|
||||
DWORD CheckSum;
|
||||
WORD Subsystem;
|
||||
WORD DllCharacteristics;
|
||||
DWORD SizeOfStackReserve;
|
||||
DWORD SizeOfStackCommit;
|
||||
DWORD SizeOfHeapReserve;
|
||||
DWORD SizeOfHeapCommit;
|
||||
DWORD LoaderFlags;
|
||||
DWORD NumberOfRvaAndSizes;
|
||||
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||
} IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
|
||||
|
||||
typedef struct _IMAGE_OPTIONAL_HEADER64 {
|
||||
WORD Magic;
|
||||
BYTE MajorLinkerVersion;
|
||||
BYTE MinorLinkerVersion;
|
||||
DWORD SizeOfCode;
|
||||
DWORD SizeOfInitializedData;
|
||||
DWORD SizeOfUninitializedData;
|
||||
DWORD AddressOfEntryPoint;
|
||||
DWORD BaseOfCode;
|
||||
ULONGLONG ImageBase;
|
||||
DWORD SectionAlignment;
|
||||
DWORD FileAlignment;
|
||||
WORD MajorOperatingSystemVersion;
|
||||
WORD MinorOperatingSystemVersion;
|
||||
WORD MajorImageVersion;
|
||||
WORD MinorImageVersion;
|
||||
WORD MajorSubsystemVersion;
|
||||
WORD MinorSubsystemVersion;
|
||||
DWORD Win32VersionValue;
|
||||
DWORD SizeOfImage;
|
||||
DWORD SizeOfHeaders;
|
||||
DWORD CheckSum;
|
||||
WORD Subsystem;
|
||||
WORD DllCharacteristics;
|
||||
ULONGLONG SizeOfStackReserve;
|
||||
ULONGLONG SizeOfStackCommit;
|
||||
ULONGLONG SizeOfHeapReserve;
|
||||
ULONGLONG SizeOfHeapCommit;
|
||||
DWORD LoaderFlags;
|
||||
DWORD NumberOfRvaAndSizes;
|
||||
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||
} IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
|
||||
|
||||
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
|
||||
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
|
||||
|
||||
typedef struct _IMAGE_NT_HEADERS64 {
|
||||
DWORD Signature;
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_OPTIONAL_HEADER64 OptionalHeader;
|
||||
} IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
|
||||
|
||||
typedef struct _IMAGE_NT_HEADERS {
|
||||
DWORD Signature;
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_OPTIONAL_HEADER32 OptionalHeader;
|
||||
} IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
|
||||
|
||||
//
|
||||
// Section header format.
|
||||
//
|
||||
|
||||
#define IMAGE_SIZEOF_SHORT_NAME 8
|
||||
|
||||
typedef struct _IMAGE_SECTION_HEADER {
|
||||
BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
|
||||
union {
|
||||
DWORD PhysicalAddress;
|
||||
DWORD VirtualSize;
|
||||
} Misc;
|
||||
DWORD VirtualAddress;
|
||||
DWORD SizeOfRawData;
|
||||
DWORD PointerToRawData;
|
||||
DWORD PointerToRelocations;
|
||||
DWORD PointerToLinenumbers;
|
||||
WORD NumberOfRelocations;
|
||||
WORD NumberOfLinenumbers;
|
||||
DWORD Characteristics;
|
||||
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
||||
|
||||
//
|
||||
// Section characteristics.
|
||||
//
|
||||
// IMAGE_SCN_TYPE_REG 0x00000000 // Reserved.
|
||||
// IMAGE_SCN_TYPE_DSECT 0x00000001 // Reserved.
|
||||
// IMAGE_SCN_TYPE_NOLOAD 0x00000002 // Reserved.
|
||||
// IMAGE_SCN_TYPE_GROUP 0x00000004 // Reserved.
|
||||
#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
|
||||
// IMAGE_SCN_TYPE_COPY 0x00000010 // Reserved.
|
||||
|
||||
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
|
||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
|
||||
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
|
||||
|
||||
#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
|
||||
#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
|
||||
// IMAGE_SCN_TYPE_OVER 0x00000400 // Reserved.
|
||||
#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
|
||||
#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat.
|
||||
// 0x00002000 // Reserved.
|
||||
// IMAGE_SCN_MEM_PROTECTED - Obsolete 0x00004000
|
||||
#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 // Reset speculative exceptions handling bits in the TLB entries for this section.
|
||||
#define IMAGE_SCN_GPREL 0x00008000 // Section content can be accessed relative to GP
|
||||
#define IMAGE_SCN_MEM_FARDATA 0x00008000
|
||||
// IMAGE_SCN_MEM_SYSHEAP - Obsolete 0x00010000
|
||||
#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
|
||||
#define IMAGE_SCN_MEM_16BIT 0x00020000
|
||||
#define IMAGE_SCN_MEM_LOCKED 0x00040000
|
||||
#define IMAGE_SCN_MEM_PRELOAD 0x00080000
|
||||
|
||||
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
|
||||
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
|
||||
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
|
||||
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
|
||||
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified.
|
||||
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
|
||||
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
|
||||
#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 //
|
||||
#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 //
|
||||
#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 //
|
||||
#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 //
|
||||
#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 //
|
||||
#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 //
|
||||
#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 //
|
||||
// Unused 0x00F00000
|
||||
#define IMAGE_SCN_ALIGN_MASK 0x00F00000
|
||||
|
||||
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 // Section contains extended relocations.
|
||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
|
||||
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
|
||||
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
|
||||
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
|
||||
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
|
||||
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
|
||||
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
|
||||
|
||||
//
|
||||
// Export Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_EXPORT_DIRECTORY {
|
||||
DWORD Characteristics;
|
||||
DWORD TimeDateStamp;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
DWORD Name;
|
||||
DWORD Base;
|
||||
DWORD NumberOfFunctions;
|
||||
DWORD NumberOfNames;
|
||||
DWORD AddressOfFunctions; // RVA from base of image
|
||||
DWORD AddressOfNames; // RVA from base of image
|
||||
DWORD AddressOfNameOrdinals; // RVA from base of image
|
||||
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
|
||||
|
||||
//
|
||||
// Import Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_IMPORT_BY_NAME {
|
||||
WORD Hint;
|
||||
BYTE Name[1];
|
||||
} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
|
||||
|
||||
#pragma pack(push, 8) // Use align 8 for the 64-bit IAT.
|
||||
|
||||
typedef struct _IMAGE_THUNK_DATA64 {
|
||||
union {
|
||||
ULONGLONG ForwarderString; // PBYTE
|
||||
ULONGLONG Function; // PDWORD
|
||||
ULONGLONG Ordinal;
|
||||
ULONGLONG AddressOfData; // PIMAGE_IMPORT_BY_NAME
|
||||
} u1;
|
||||
} IMAGE_THUNK_DATA64;
|
||||
typedef IMAGE_THUNK_DATA64 * PIMAGE_THUNK_DATA64;
|
||||
|
||||
#pragma pack(pop) // Back to 4 byte packing
|
||||
|
||||
typedef struct _IMAGE_THUNK_DATA32 {
|
||||
union {
|
||||
DWORD ForwarderString; // PBYTE
|
||||
DWORD Function; // PDWORD
|
||||
DWORD Ordinal;
|
||||
DWORD AddressOfData; // PIMAGE_IMPORT_BY_NAME
|
||||
} u1;
|
||||
} IMAGE_THUNK_DATA32;
|
||||
typedef IMAGE_THUNK_DATA32 * PIMAGE_THUNK_DATA32;
|
||||
|
||||
#define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL
|
||||
#define IMAGE_ORDINAL_FLAG32 0x80000000
|
||||
#define IMAGE_ORDINAL64(Ordinal) ((Ordinal) & 0xffff)
|
||||
#define IMAGE_ORDINAL32(Ordinal) ((Ordinal) & 0xffff)
|
||||
#define IMAGE_SNAP_BY_ORDINAL64(Ordinal) (((Ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
|
||||
#define IMAGE_SNAP_BY_ORDINAL32(Ordinal) (((Ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
|
||||
|
||||
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
|
||||
union {
|
||||
DWORD Characteristics; // 0 for terminating null import descriptor
|
||||
DWORD OriginalFirstThunk; // RVA to original unbound IAT (PIMAGE_THUNK_DATA)
|
||||
} DUMMYUNIONNAME;
|
||||
DWORD TimeDateStamp; // 0 if not bound,
|
||||
// -1 if bound, and real date\time stamp
|
||||
// in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT (new BIND)
|
||||
// O.W. date/time stamp of DLL bound to (Old BIND)
|
||||
|
||||
DWORD ForwarderChain; // -1 if no forwarders
|
||||
DWORD Name;
|
||||
DWORD FirstThunk; // RVA to IAT (if bound this IAT has actual addresses)
|
||||
} IMAGE_IMPORT_DESCRIPTOR;
|
||||
typedef IMAGE_IMPORT_DESCRIPTOR *PIMAGE_IMPORT_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// Resource Format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_RESOURCE_DIRECTORY {
|
||||
DWORD Characteristics;
|
||||
DWORD TimeDateStamp;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
WORD NumberOfNamedEntries;
|
||||
WORD NumberOfIdEntries;
|
||||
// IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[];
|
||||
} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
|
||||
|
||||
#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
|
||||
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
|
||||
|
||||
typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
|
||||
union {
|
||||
struct {
|
||||
DWORD NameOffset:31;
|
||||
DWORD NameIsString:1;
|
||||
} DUMMYSTRUCTNAME;
|
||||
DWORD Name;
|
||||
WORD Id;
|
||||
} DUMMYUNIONNAME;
|
||||
union {
|
||||
DWORD OffsetToData;
|
||||
struct {
|
||||
DWORD OffsetToDirectory:31;
|
||||
DWORD DataIsDirectory:1;
|
||||
} DUMMYSTRUCTNAME2;
|
||||
} DUMMYUNIONNAME2;
|
||||
} IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
|
||||
|
||||
typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
|
||||
DWORD OffsetToData;
|
||||
DWORD Size;
|
||||
DWORD CodePage;
|
||||
DWORD Reserved;
|
||||
} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
|
||||
|
||||
//
|
||||
// Based relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_BASE_RELOCATION {
|
||||
DWORD VirtualAddress;
|
||||
DWORD SizeOfBlock;
|
||||
// WORD TypeOffset[1];
|
||||
} IMAGE_BASE_RELOCATION;
|
||||
typedef IMAGE_BASE_RELOCATION * PIMAGE_BASE_RELOCATION;
|
||||
|
||||
//
|
||||
// Based relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
typedef enum _EXCEPTION_DISPOSITION {
|
||||
ExceptionContinueExecution,
|
||||
ExceptionContinueSearch,
|
||||
ExceptionNestedException,
|
||||
ExceptionCollidedUnwind
|
||||
} EXCEPTION_DISPOSITION;
|
||||
|
||||
//
|
||||
// Thread Local Storage
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_TLS_DIRECTORY64 {
|
||||
ULONGLONG StartAddressOfRawData;
|
||||
ULONGLONG EndAddressOfRawData;
|
||||
ULONGLONG AddressOfIndex; // PDWORD
|
||||
ULONGLONG AddressOfCallBacks; // PIMAGE_TLS_CALLBACK *;
|
||||
DWORD SizeOfZeroFill;
|
||||
union { DWORD Characteristics; };
|
||||
} IMAGE_TLS_DIRECTORY64;
|
||||
typedef IMAGE_TLS_DIRECTORY64 * PIMAGE_TLS_DIRECTORY64;
|
||||
|
||||
typedef struct _IMAGE_TLS_DIRECTORY32 {
|
||||
DWORD StartAddressOfRawData;
|
||||
DWORD EndAddressOfRawData;
|
||||
DWORD AddressOfIndex; // PDWORD
|
||||
DWORD AddressOfCallBacks; // PIMAGE_TLS_CALLBACK *
|
||||
DWORD SizeOfZeroFill;
|
||||
union { DWORD Characteristics; };
|
||||
} IMAGE_TLS_DIRECTORY32;
|
||||
typedef IMAGE_TLS_DIRECTORY32 * PIMAGE_TLS_DIRECTORY32;
|
||||
|
||||
//
|
||||
// Debug Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_DEBUG_DIRECTORY {
|
||||
DWORD Characteristics;
|
||||
DWORD TimeDateStamp;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
DWORD Type;
|
||||
DWORD SizeOfData;
|
||||
DWORD AddressOfRawData;
|
||||
DWORD PointerToRawData;
|
||||
} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
|
||||
|
||||
#define IMAGE_DEBUG_TYPE_UNKNOWN 0
|
||||
#define IMAGE_DEBUG_TYPE_COFF 1
|
||||
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
|
||||
#define IMAGE_DEBUG_TYPE_FPO 3
|
||||
#define IMAGE_DEBUG_TYPE_MISC 4
|
||||
#define IMAGE_DEBUG_TYPE_EXCEPTION 5
|
||||
#define IMAGE_DEBUG_TYPE_FIXUP 6
|
||||
#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
|
||||
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
|
||||
#define IMAGE_DEBUG_TYPE_BORLAND 9
|
||||
#define IMAGE_DEBUG_TYPE_RESERVED10 10
|
||||
|
||||
typedef struct _IMAGE_SYMBOL {
|
||||
union {
|
||||
BYTE ShortName[8];
|
||||
struct {
|
||||
DWORD Short; // if 0, use LongName
|
||||
DWORD Long; // offset into string table
|
||||
} Name;
|
||||
DWORD LongName[2]; // PBYTE [2]
|
||||
} N;
|
||||
DWORD Value;
|
||||
SHORT SectionNumber;
|
||||
WORD Type;
|
||||
BYTE StorageClass;
|
||||
BYTE NumberOfAuxSymbols;
|
||||
} IMAGE_SYMBOL;
|
||||
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL 0x0002
|
||||
#define IMAGE_SYM_CLASS_STATIC 0x0003
|
||||
|
||||
#endif // VMP_GNU
|
||||
|
||||
#ifndef RUNTIME_FUNCTION_INDIRECT
|
||||
typedef struct _RUNTIME_FUNCTION {
|
||||
DWORD BeginAddress;
|
||||
DWORD EndAddress;
|
||||
union {
|
||||
DWORD UnwindInfoAddress;
|
||||
DWORD UnwindData;
|
||||
};
|
||||
} RUNTIME_FUNCTION;
|
||||
#endif
|
||||
|
||||
typedef enum _UNWIND_OP_CODES
|
||||
{
|
||||
UWOP_PUSH_NONVOL = 0, /* info == register number */
|
||||
UWOP_ALLOC_LARGE, /* no info, alloc size in next 2 slots */
|
||||
UWOP_ALLOC_SMALL, /* info == size of allocation / 8 - 1 */
|
||||
UWOP_SET_FPREG, /* no info, FP = RSP + UNWIND_INFO.FPRegOffset*16 */
|
||||
UWOP_SAVE_NONVOL, /* info == register number, offset in next slot */
|
||||
UWOP_SAVE_NONVOL_FAR, /* info == register number, offset in next 2 slots */
|
||||
UWOP_EPILOG,
|
||||
UWOP_SAVE_XMM128 = 8, /* info == XMM reg number, offset in next slot */
|
||||
UWOP_SAVE_XMM128_FAR, /* info == XMM reg number, offset in next 2 slots */
|
||||
UWOP_PUSH_MACHFRAME /* info == 0: no error-code, 1: error-code */
|
||||
} UNWIND_CODE_OPS;
|
||||
|
||||
typedef union _UNWIND_CODE
|
||||
{
|
||||
struct {
|
||||
BYTE CodeOffset;
|
||||
BYTE UnwindOp : 4;
|
||||
BYTE OpInfo : 4;
|
||||
};
|
||||
USHORT FrameOffset;
|
||||
} UNWIND_CODE, *PUNWIND_CODE;
|
||||
|
||||
typedef struct _UNWIND_INFO
|
||||
{
|
||||
BYTE Version : 3;
|
||||
BYTE Flags : 5;
|
||||
BYTE SizeOfProlog;
|
||||
BYTE CountOfCodes;
|
||||
BYTE FrameRegister : 4;
|
||||
BYTE FrameOffset : 4;
|
||||
UNWIND_CODE UnwindCode[1];
|
||||
/* UNWIND_CODE MoreUnwindCode[((CountOfCodes + 1) & ~1) - 1];
|
||||
* union {
|
||||
* OPTIONAL ULONG ExceptionHandler;
|
||||
* OPTIONAL ULONG FunctionEntry;
|
||||
* };
|
||||
* OPTIONAL ULONG ExceptionData[]; */
|
||||
} UNWIND_INFO, *PUNWIND_INFO;
|
||||
|
||||
#ifndef UNW_FLAG_NHANDLER
|
||||
#define UNW_FLAG_NHANDLER 0
|
||||
#define UNW_FLAG_EHANDLER 1
|
||||
#define UNW_FLAG_UHANDLER 2
|
||||
#define UNW_FLAG_CHAININFO 4
|
||||
#endif
|
||||
|
||||
typedef struct _CONTEXT64 {
|
||||
|
||||
//
|
||||
// Register parameter home addresses.
|
||||
//
|
||||
// N.B. These fields are for convience - they could be used to extend the
|
||||
// context record in the future.
|
||||
//
|
||||
|
||||
DWORD64 P1Home;
|
||||
DWORD64 P2Home;
|
||||
DWORD64 P3Home;
|
||||
DWORD64 P4Home;
|
||||
DWORD64 P5Home;
|
||||
DWORD64 P6Home;
|
||||
|
||||
//
|
||||
// Control flags.
|
||||
//
|
||||
|
||||
DWORD ContextFlags;
|
||||
DWORD MxCsr;
|
||||
|
||||
//
|
||||
// Segment Registers and processor flags.
|
||||
//
|
||||
|
||||
WORD SegCs;
|
||||
WORD SegDs;
|
||||
WORD SegEs;
|
||||
WORD SegFs;
|
||||
WORD SegGs;
|
||||
WORD SegSs;
|
||||
DWORD EFlags;
|
||||
|
||||
//
|
||||
// Debug registers
|
||||
//
|
||||
|
||||
DWORD64 Dr0;
|
||||
DWORD64 Dr1;
|
||||
DWORD64 Dr2;
|
||||
DWORD64 Dr3;
|
||||
DWORD64 Dr6;
|
||||
DWORD64 Dr7;
|
||||
|
||||
//
|
||||
// Integer registers.
|
||||
//
|
||||
|
||||
DWORD64 Rax;
|
||||
DWORD64 Rcx;
|
||||
DWORD64 Rdx;
|
||||
DWORD64 Rbx;
|
||||
DWORD64 Rsp;
|
||||
DWORD64 Rbp;
|
||||
DWORD64 Rsi;
|
||||
DWORD64 Rdi;
|
||||
DWORD64 R8;
|
||||
DWORD64 R9;
|
||||
DWORD64 R10;
|
||||
DWORD64 R11;
|
||||
DWORD64 R12;
|
||||
DWORD64 R13;
|
||||
DWORD64 R14;
|
||||
DWORD64 R15;
|
||||
|
||||
//
|
||||
// Program counter.
|
||||
//
|
||||
|
||||
DWORD64 Rip;
|
||||
|
||||
//
|
||||
// Floating point state.
|
||||
//
|
||||
|
||||
/*
|
||||
union {
|
||||
XMM_SAVE_AREA32 FltSave;
|
||||
struct {
|
||||
M128A Header[2];
|
||||
M128A Legacy[8];
|
||||
M128A Xmm0;
|
||||
M128A Xmm1;
|
||||
M128A Xmm2;
|
||||
M128A Xmm3;
|
||||
M128A Xmm4;
|
||||
M128A Xmm5;
|
||||
M128A Xmm6;
|
||||
M128A Xmm7;
|
||||
M128A Xmm8;
|
||||
M128A Xmm9;
|
||||
M128A Xmm10;
|
||||
M128A Xmm11;
|
||||
M128A Xmm12;
|
||||
M128A Xmm13;
|
||||
M128A Xmm14;
|
||||
M128A Xmm15;
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
|
||||
//
|
||||
// Vector registers.
|
||||
//
|
||||
|
||||
M128A VectorRegister[26];
|
||||
DWORD64 VectorControl;
|
||||
|
||||
//
|
||||
// Special debug control registers.
|
||||
//
|
||||
|
||||
DWORD64 DebugControl;
|
||||
DWORD64 LastBranchToRip;
|
||||
DWORD64 LastBranchFromRip;
|
||||
DWORD64 LastExceptionToRip;
|
||||
DWORD64 LastExceptionFromRip;
|
||||
*/
|
||||
} CONTEXT64;
|
||||
|
||||
typedef struct _IMAGE_DELAY_IMPORT_DESCRIPTOR {
|
||||
DWORD Attrs;
|
||||
DWORD DllName;
|
||||
DWORD Hmod;
|
||||
DWORD IAT;
|
||||
DWORD INT;
|
||||
DWORD BoundIAT;
|
||||
DWORD UnloadIAT;
|
||||
DWORD TimeStamp;
|
||||
} IMAGE_DELAY_IMPORT_DESCRIPTOR;
|
||||
|
||||
typedef struct _IMAGE_LOAD_CONFIG_CODE_INTEGRITY {
|
||||
WORD Flags; // Flags to indicate if CI information is available, etc.
|
||||
WORD Catalog; // 0xFFFF means not available
|
||||
DWORD CatalogOffset;
|
||||
DWORD Reserved; // Additional bitmask to be defined later
|
||||
} IMAGE_LOAD_CONFIG_CODE_INTEGRITY, *PIMAGE_LOAD_CONFIG_CODE_INTEGRITY;
|
||||
|
||||
//
|
||||
// Load Configuration Directory Entry
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_LOAD_CONFIG_DIRECTORYEX32 {
|
||||
DWORD Size;
|
||||
DWORD TimeDateStamp;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
DWORD GlobalFlagsClear;
|
||||
DWORD GlobalFlagsSet;
|
||||
DWORD CriticalSectionDefaultTimeout;
|
||||
DWORD DeCommitFreeBlockThreshold;
|
||||
DWORD DeCommitTotalFreeThreshold;
|
||||
DWORD LockPrefixTable; // VA
|
||||
DWORD MaximumAllocationSize;
|
||||
DWORD VirtualMemoryThreshold;
|
||||
DWORD ProcessHeapFlags;
|
||||
DWORD ProcessAffinityMask;
|
||||
WORD CSDVersion;
|
||||
WORD DependentLoadFlags;
|
||||
DWORD EditList; // VA
|
||||
DWORD SecurityCookie; // VA
|
||||
DWORD SEHandlerTable; // VA
|
||||
DWORD SEHandlerCount;
|
||||
DWORD GuardCFCheckFunctionPointer; // VA
|
||||
DWORD GuardCFDispatchFunctionPointer; // VA
|
||||
DWORD GuardCFFunctionTable; // VA
|
||||
DWORD GuardCFFunctionCount;
|
||||
DWORD GuardFlags;
|
||||
IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity;
|
||||
DWORD GuardAddressTakenIatEntryTable; // VA
|
||||
DWORD GuardAddressTakenIatEntryCount;
|
||||
DWORD GuardLongJumpTargetTable; // VA
|
||||
DWORD GuardLongJumpTargetCount;
|
||||
DWORD DynamicValueRelocTable; // VA
|
||||
DWORD CHPEMetadataPointer;
|
||||
DWORD GuardRFFailureRoutine; // VA
|
||||
DWORD GuardRFFailureRoutineFunctionPointer; // VA
|
||||
DWORD DynamicValueRelocTableOffset;
|
||||
WORD DynamicValueRelocTableSection;
|
||||
WORD Reserved2;
|
||||
} IMAGE_LOAD_CONFIG_DIRECTORYEX32, *PIMAGE_LOAD_CONFIG_DIRECTORYEX32;
|
||||
|
||||
typedef struct _IMAGE_LOAD_CONFIG_DIRECTORYEX64 {
|
||||
DWORD Size;
|
||||
DWORD TimeDateStamp;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
DWORD GlobalFlagsClear;
|
||||
DWORD GlobalFlagsSet;
|
||||
DWORD CriticalSectionDefaultTimeout;
|
||||
ULONGLONG DeCommitFreeBlockThreshold;
|
||||
ULONGLONG DeCommitTotalFreeThreshold;
|
||||
ULONGLONG LockPrefixTable; // VA
|
||||
ULONGLONG MaximumAllocationSize;
|
||||
ULONGLONG VirtualMemoryThreshold;
|
||||
ULONGLONG ProcessAffinityMask;
|
||||
DWORD ProcessHeapFlags;
|
||||
WORD CSDVersion;
|
||||
WORD DependentLoadFlags;
|
||||
ULONGLONG EditList; // VA
|
||||
ULONGLONG SecurityCookie; // VA
|
||||
ULONGLONG SEHandlerTable; // VA
|
||||
ULONGLONG SEHandlerCount;
|
||||
ULONGLONG GuardCFCheckFunctionPointer; // VA
|
||||
ULONGLONG GuardCFDispatchFunctionPointer; // VA
|
||||
ULONGLONG GuardCFFunctionTable; // VA
|
||||
ULONGLONG GuardCFFunctionCount;
|
||||
DWORD GuardFlags;
|
||||
IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity;
|
||||
ULONGLONG GuardAddressTakenIatEntryTable; // VA
|
||||
ULONGLONG GuardAddressTakenIatEntryCount;
|
||||
ULONGLONG GuardLongJumpTargetTable; // VA
|
||||
ULONGLONG GuardLongJumpTargetCount;
|
||||
ULONGLONG DynamicValueRelocTable; // VA
|
||||
ULONGLONG CHPEMetadataPointer; // VA
|
||||
ULONGLONG GuardRFFailureRoutine; // VA
|
||||
ULONGLONG GuardRFFailureRoutineFunctionPointer; // VA
|
||||
DWORD DynamicValueRelocTableOffset;
|
||||
WORD DynamicValueRelocTableSection;
|
||||
WORD Reserved2;
|
||||
} IMAGE_LOAD_CONFIG_DIRECTORYEX64, *PIMAGE_LOAD_CONFIG_DIRECTORYEX64;
|
||||
|
||||
#define IMAGE_GUARD_CF_INSTRUMENTED 0x00000100 // Module performs control flow integrity checks using system-supplied support
|
||||
#define IMAGE_GUARD_CFW_INSTRUMENTED 0x00000200 // Module performs control flow and write integrity checks
|
||||
#define IMAGE_GUARD_CF_FUNCTION_TABLE_PRESENT 0x00000400 // Module contains valid control flow target metadata
|
||||
#define IMAGE_GUARD_SECURITY_COOKIE_UNUSED 0x00000800 // Module does not make use of the /GS security cookie
|
||||
#define IMAGE_GUARD_PROTECT_DELAYLOAD_IAT 0x00001000 // Module supports read only delay load IAT
|
||||
#define IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION 0x00002000 // Delayload import table in its own .didat section (with nothing else in it) that can be freely reprotected
|
||||
#define IMAGE_GUARD_CF_EXPORT_SUPPRESSION_INFO_PRESENT 0x00004000 // Module contains suppressed export information
|
||||
#define IMAGE_GUARD_CF_ENABLE_EXPORT_SUPPRESSION 0x00008000 // Module enables suppression of exports
|
||||
#define IMAGE_GUARD_CF_LONGJUMP_TABLE_PRESENT 0x00010000 // Module contains longjmp target information
|
||||
#define IMAGE_GUARD_RF_INSTRUMENTED 0x00020000 // Module contains return flow instrumentation and metadata
|
||||
#define IMAGE_GUARD_RF_ENABLE 0x00040000 // Module requests that the OS enable return flow protection
|
||||
#define IMAGE_GUARD_RF_STRICT 0x00080000 // Module requests that the OS enable return flow protection in strict mode
|
||||
#define IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_MASK 0xF0000000 // Stride of Guard CF function table encoded in these bits (additional count of bytes per element)
|
||||
#define IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT 28 // Shift to right-justify Guard CF function table stride
|
||||
|
||||
#endif // PE_H
|
||||
+6125
File diff suppressed because it is too large
Load Diff
+925
@@ -0,0 +1,925 @@
|
||||
/**
|
||||
* Support of PE executable files.
|
||||
*/
|
||||
|
||||
#ifndef PEFILE_H
|
||||
#define PEFILE_H
|
||||
|
||||
class PEArchitecture;
|
||||
class PEDirectoryList;
|
||||
class PESegmentList;
|
||||
class PEImportList;
|
||||
class PEFixupList;
|
||||
class PERelocationList;
|
||||
class PELoadConfigDirectory;
|
||||
class PERuntimeFunctionList;
|
||||
|
||||
class PEDirectory : public BaseLoadCommand
|
||||
{
|
||||
public:
|
||||
explicit PEDirectory(PEDirectoryList *owner, uint32_t type);
|
||||
explicit PEDirectory(PEDirectoryList *owner, const PEDirectory &src);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint32_t size() const { return size_; }
|
||||
virtual uint32_t type() const { return type_; }
|
||||
uint32_t physical_size() const { return physical_size_ ? physical_size_ : size_; }
|
||||
void set_physical_size(uint32_t physical_size) { physical_size_ = physical_size; }
|
||||
virtual std::string name() const;
|
||||
void ReadFromFile(PEArchitecture &file);
|
||||
void WriteToFile(PEArchitecture &file) const;
|
||||
virtual PEDirectory *Clone(ILoadCommandList *owner) const;
|
||||
void clear();
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
void set_size(uint32_t size) { size_ = size; }
|
||||
void Rebase(uint64_t delta_base);
|
||||
virtual bool visible() const { return (address_ || size_); }
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint32_t size_;
|
||||
uint32_t type_;
|
||||
uint32_t physical_size_;
|
||||
};
|
||||
|
||||
class PEDirectoryList : public BaseCommandList
|
||||
{
|
||||
public:
|
||||
explicit PEDirectoryList(PEArchitecture *owner);
|
||||
explicit PEDirectoryList(PEArchitecture *owner, const PEDirectoryList &src);
|
||||
PEDirectoryList *Clone(PEArchitecture *owner) const;
|
||||
PEDirectory *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &file, uint32_t count);
|
||||
void WriteToFile(PEArchitecture &file) const;
|
||||
PEDirectory *GetCommandByType(uint32_t type) const;
|
||||
PEDirectory *GetCommandByAddress(uint64_t address) const;
|
||||
private:
|
||||
PEDirectory *Add(uint32_t type);
|
||||
};
|
||||
|
||||
class PESegment : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit PESegment(PESegmentList *owner);
|
||||
explicit PESegment(PESegmentList *owner, uint64_t address, uint32_t size, uint32_t physical_offset,
|
||||
uint32_t physical_size, uint32_t flags, const std::string &name);
|
||||
explicit PESegment(PESegmentList *owner, const PESegment &src);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return physical_offset_; }
|
||||
virtual uint32_t physical_size() const { return physical_size_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual uint32_t memory_type() const;
|
||||
virtual uint32_t flags() const { return flags_; }
|
||||
void set_flags(uint32_t flags) { flags_ = flags; }
|
||||
void set_size(uint32_t size) { size_ = size; }
|
||||
void set_physical_size(uint32_t size) { physical_size_ = size; }
|
||||
void set_physical_offset(uint32_t offset) { physical_offset_ = offset; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
void ReadFromFile(PEArchitecture &file);
|
||||
void WriteToFile(PEArchitecture &file) const;
|
||||
virtual PESegment *Clone(ISectionList *owner) const;
|
||||
virtual void update_type(uint32_t mt);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
std::string name_;
|
||||
uint64_t address_;
|
||||
uint32_t size_;
|
||||
uint32_t physical_offset_;
|
||||
uint32_t physical_size_;
|
||||
uint32_t flags_;
|
||||
};
|
||||
|
||||
class PESegmentList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit PESegmentList(PEArchitecture *owner);
|
||||
explicit PESegmentList(PEArchitecture *owner, const PESegmentList &src);
|
||||
~PESegmentList();
|
||||
PESegmentList *Clone(PEArchitecture *owner) const;
|
||||
PESegment *item(size_t index) const;
|
||||
PESegment *GetSectionByAddress(uint64_t address) const;
|
||||
void ReadFromFile(PEArchitecture &file, uint32_t count);
|
||||
void WriteToFile(PEArchitecture &file) const;
|
||||
PESegment *last() const;
|
||||
PESegment *Add(uint64_t address, uint32_t size, uint32_t physical_offset, uint32_t physical_size, uint32_t flags, const std::string &name);
|
||||
PESegment *header_segment() const { return header_segment_; }
|
||||
private:
|
||||
PESegment *Add();
|
||||
|
||||
PESegment *header_segment_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
PESegmentList(const PESegmentList &);
|
||||
PESegmentList &operator =(const PESegmentList &);
|
||||
};
|
||||
|
||||
class PESectionList;
|
||||
|
||||
class PESection : public BaseSection
|
||||
{
|
||||
public:
|
||||
explicit PESection(PESectionList *owner, PESegment *parent, uint64_t address, uint64_t size, const std::string &name);
|
||||
explicit PESection(PESectionList *owner, const PESection &src);
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t size() const { return size_; }
|
||||
virtual uint32_t physical_offset() const { return parent_->physical_offset() + static_cast<uint32_t>(address_ - parent_->address()); }
|
||||
virtual uint32_t physical_size() const { return static_cast<uint32_t>(size_); }
|
||||
virtual uint32_t memory_type() const { return parent_->memory_type(); }
|
||||
virtual uint32_t flags() const { return 0; }
|
||||
virtual void update_type(uint32_t mt) {}
|
||||
virtual PESection *Clone(ISectionList *owner) const;
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
virtual PESegment *parent() const { return parent_; }
|
||||
void set_parent(PESegment *parent) { parent_ = parent; }
|
||||
private:
|
||||
std::string name_;
|
||||
uint64_t address_;
|
||||
uint64_t size_;
|
||||
PESegment *parent_;
|
||||
};
|
||||
|
||||
class PESectionList : public BaseSectionList
|
||||
{
|
||||
public:
|
||||
explicit PESectionList(PEArchitecture *owner);
|
||||
explicit PESectionList(PEArchitecture *owner, const PESectionList &src);
|
||||
virtual PESectionList *Clone(PEArchitecture *owner) const;
|
||||
PESection *item(size_t index) const;
|
||||
PESection *Add(PESegment *parent, uint64_t address, uint64_t size, const std::string &name);
|
||||
};
|
||||
|
||||
class PEImport;
|
||||
|
||||
class PEImportFunction : public BaseImportFunction
|
||||
{
|
||||
public:
|
||||
explicit PEImportFunction(PEImport *owner);
|
||||
explicit PEImportFunction(PEImport *owner, const std::string &name);
|
||||
explicit PEImportFunction(PEImport *owner, uint64_t address, APIType type, MapFunction *map_function);
|
||||
explicit PEImportFunction(PEImport *owner, const PEImportFunction &src);
|
||||
virtual PEImportFunction *Clone(IImport *owner) const;
|
||||
bool ReadFromFile(PEArchitecture &arch, uint32_t &rva);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
bool is_ordinal() const { return is_ordinal_; }
|
||||
uint32_t ordinal() const { return ordinal_; }
|
||||
void FreeByManager(MemoryManager &manager, bool free_iat);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
bool IsInternal(const CompileContext &ctx) const;
|
||||
private:
|
||||
std::string name_;
|
||||
uint64_t name_address_;
|
||||
uint64_t address_;
|
||||
bool is_ordinal_;
|
||||
uint32_t ordinal_;
|
||||
};
|
||||
|
||||
class PEImport : public BaseImport
|
||||
{
|
||||
public:
|
||||
explicit PEImport(PEImportList *owner);
|
||||
explicit PEImport(PEImportList *owner, bool is_sdk);
|
||||
explicit PEImport(PEImportList *owner, const std::string &name);
|
||||
explicit PEImport(PEImportList *owner, const PEImport &src);
|
||||
virtual PEImport *Clone(IImportList *owner) const;
|
||||
PEImportFunction *item(size_t index) const;
|
||||
bool ReadFromFile(PEArchitecture &file);
|
||||
void WriteToFile(PEArchitecture &file) const;
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual bool is_sdk() const { return is_sdk_; }
|
||||
bool FreeByManager(MemoryManager &manager, bool free_iat);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
protected:
|
||||
virtual PEImportFunction *Add(uint64_t address, APIType type, MapFunction *map_function);
|
||||
private:
|
||||
std::string name_;
|
||||
uint64_t name_address_;
|
||||
bool is_sdk_;
|
||||
uint64_t original_first_thunk_address_;
|
||||
uint64_t first_thunk_address_;
|
||||
uint32_t time_stamp_;
|
||||
uint32_t forwarder_chain_;
|
||||
};
|
||||
|
||||
class PEImportList : public BaseImportList
|
||||
{
|
||||
public:
|
||||
explicit PEImportList(PEArchitecture *owner);
|
||||
explicit PEImportList(PEArchitecture *owner, const PEImportList &src);
|
||||
virtual PEImportList *Clone(PEArchitecture *owner) const;
|
||||
PEImport *item(size_t index) const;
|
||||
virtual PEImportFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &dir);
|
||||
void FreeByManager(MemoryManager &manager, bool free_iat);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
void WriteToFile(PEArchitecture &file, bool skip_sdk = false) const;
|
||||
protected:
|
||||
virtual PEImport *AddSDK();
|
||||
private:
|
||||
uint64_t address_;
|
||||
};
|
||||
|
||||
class PEDelayImport;
|
||||
class PEDelayImportList;
|
||||
|
||||
class PEDelayImportFunction : public IObject
|
||||
{
|
||||
public:
|
||||
explicit PEDelayImportFunction(PEDelayImport *owner);
|
||||
explicit PEDelayImportFunction(PEDelayImport *owner, const PEDelayImportFunction &src);
|
||||
~PEDelayImportFunction();
|
||||
PEDelayImportFunction *Clone(PEDelayImport *owner) const;
|
||||
bool ReadFromFile(PEArchitecture &file, uint64_t add_value);
|
||||
std::string name() const { return name_; }
|
||||
bool is_ordinal() const { return is_ordinal_; }
|
||||
uint32_t ordinal() const { return ordinal_; }
|
||||
private:
|
||||
PEDelayImport *owner_;
|
||||
|
||||
std::string name_;
|
||||
bool is_ordinal_;
|
||||
uint32_t ordinal_;
|
||||
};
|
||||
|
||||
class PEDelayImport : public ObjectList<PEDelayImportFunction>
|
||||
{
|
||||
public:
|
||||
explicit PEDelayImport(PEDelayImportList *owner);
|
||||
explicit PEDelayImport(PEDelayImportList *owner, const PEDelayImport &src);
|
||||
~PEDelayImport();
|
||||
PEDelayImport *Clone(PEDelayImportList *owner) const;
|
||||
bool ReadFromFile(PEArchitecture &file);
|
||||
virtual std::string name() const { return name_; }
|
||||
uint32_t flags() const { return flags_; }
|
||||
uint64_t module() const { return module_; }
|
||||
uint64_t iat() const { return iat_; }
|
||||
uint64_t bound_iat() const { return bound_iat_; }
|
||||
uint64_t unload_iat() const { return unload_iat_; }
|
||||
uint32_t time_stamp() const { return time_stamp_; }
|
||||
private:
|
||||
PEDelayImportList *owner_;
|
||||
|
||||
std::string name_;
|
||||
uint32_t flags_;
|
||||
uint64_t module_;
|
||||
uint64_t iat_;
|
||||
uint64_t bound_iat_;
|
||||
uint64_t unload_iat_;
|
||||
uint32_t time_stamp_;
|
||||
};
|
||||
|
||||
class PEDelayImportList : public ObjectList<PEDelayImport>
|
||||
{
|
||||
public:
|
||||
explicit PEDelayImportList();
|
||||
explicit PEDelayImportList(const PEDelayImportList &src);
|
||||
PEDelayImportList *Clone() const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &dir);
|
||||
};
|
||||
|
||||
class PEExportList;
|
||||
|
||||
class PEExport : public BaseExport
|
||||
{
|
||||
public:
|
||||
explicit PEExport(PEExportList *owner, uint64_t address, uint32_t ordinal);
|
||||
explicit PEExport(PEExportList *owner, const PEExport &src);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual std::string name() const { return name_; }
|
||||
virtual std::string forwarded_name() const { return forwarded_name_; }
|
||||
virtual std::string display_name(bool show_ret = true) const;
|
||||
uint32_t ordinal() const { return ordinal_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
void set_forwarded_name(const std::string &forwarded_name) { forwarded_name_ = forwarded_name; }
|
||||
virtual PEExport *Clone(IExportList *owner) const;
|
||||
/*virtual*/ int CompareWith(const IObject &obj) const;
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
void ReadFromFile(PEArchitecture &file, uint64_t address_of_name, bool is_forwarded);
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint32_t ordinal_;
|
||||
uint64_t address_of_name_;
|
||||
std::string name_;
|
||||
std::string forwarded_name_;
|
||||
};
|
||||
|
||||
class PEExportList : public BaseExportList
|
||||
{
|
||||
public:
|
||||
explicit PEExportList(PEArchitecture *owner);
|
||||
explicit PEExportList(PEArchitecture *owner, const PEExportList &src);
|
||||
virtual PEExportList *Clone(PEArchitecture *owner) const;
|
||||
virtual std::string name() const { return name_; }
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
uint32_t characteristics() const { return characteristics_; }
|
||||
uint32_t time_date_stamp() const { return time_date_stamp_; }
|
||||
uint16_t major_version() const { return major_version_; }
|
||||
uint16_t minor_version() const { return minor_version_; }
|
||||
PEExport *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &arch, PEDirectory &dir);
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
virtual void ReadFromBuffer(Buffer &buffer, IArchitecture &file);
|
||||
uint32_t WriteToData(IFunction &data, uint64_t image_base);
|
||||
void AddAntidebug();
|
||||
protected:
|
||||
virtual PEExport *Add(uint64_t address) { return Add(address, 0); }
|
||||
private:
|
||||
PEExport *Add(uint64_t address, uint32_t ordinal);
|
||||
PEExport *GetExportByOrdinal(uint32_t ordinal);
|
||||
|
||||
uint64_t address_;
|
||||
uint64_t name_address_;
|
||||
uint32_t characteristics_;
|
||||
uint32_t time_date_stamp_;
|
||||
uint16_t major_version_;
|
||||
uint16_t minor_version_;
|
||||
std::string name_;
|
||||
uint32_t number_of_functions_;
|
||||
uint64_t address_of_functions_;
|
||||
uint32_t number_of_names_;
|
||||
uint64_t address_of_names_;
|
||||
uint64_t address_of_name_ordinals_;
|
||||
|
||||
struct NameInfo {
|
||||
uint32_t ordinal_index;
|
||||
uint32_t address_of_name;
|
||||
bool operator == (uint16_t ordinal_index_) const
|
||||
{
|
||||
return (ordinal_index == ordinal_index_);
|
||||
}
|
||||
};
|
||||
|
||||
struct ExportInfo {
|
||||
PEExport *export_function;
|
||||
ExportInfo(PEExport *export_function_) : export_function(export_function_) {}
|
||||
bool operator< (const ExportInfo &obj) const
|
||||
{
|
||||
return (export_function->name().compare(obj.export_function->name()) < 0);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class PEFixup : public BaseFixup
|
||||
{
|
||||
public:
|
||||
explicit PEFixup(PEFixupList *owner, uint64_t address, uint8_t type);
|
||||
explicit PEFixup(PEFixupList *owner, const PEFixup &src);
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual FixupType type() const;
|
||||
virtual OperandSize size() const;
|
||||
virtual PEFixup *Clone(IFixupList *owner) const;
|
||||
uint8_t internal_type() const { return type_; }
|
||||
virtual void set_address(uint64_t address) { address_ = address; }
|
||||
virtual void Rebase(IArchitecture &file, uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint8_t type_;
|
||||
};
|
||||
|
||||
class PEFixupList : public BaseFixupList
|
||||
{
|
||||
public:
|
||||
explicit PEFixupList();
|
||||
explicit PEFixupList(const PEFixupList &src);
|
||||
virtual PEFixupList *Clone() const;
|
||||
PEFixup *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &dir);
|
||||
void WriteToData(Data &data, uint64_t image_base);
|
||||
size_t WriteToFile(PEArchitecture &file);
|
||||
virtual IFixup *AddDefault(OperandSize cpu_address_size, bool is_code);
|
||||
private:
|
||||
PEFixup *Add(uint64_t address, uint8_t type);
|
||||
|
||||
// no assignment op
|
||||
PEFixupList &operator =(const PEFixupList &);
|
||||
};
|
||||
|
||||
class PERelocation : public BaseRelocation
|
||||
{
|
||||
public:
|
||||
explicit PERelocation(PERelocationList *owner, uint64_t address, uint64_t source, OperandSize size, uint32_t addend);
|
||||
explicit PERelocation(PERelocationList *owner, const PERelocation &src);
|
||||
virtual PERelocation *Clone(IRelocationList *owner) const;
|
||||
uint64_t source() const { return source_; }
|
||||
uint32_t addend() const { return addend_; }
|
||||
virtual ISymbol *symbol() const { return NULL; }
|
||||
private:
|
||||
uint64_t source_;
|
||||
uint32_t addend_;
|
||||
};
|
||||
|
||||
class PERelocationList : public BaseRelocationList
|
||||
{
|
||||
public:
|
||||
explicit PERelocationList();
|
||||
explicit PERelocationList(const PERelocationList &src);
|
||||
virtual PERelocationList *Clone() const;
|
||||
PERelocation *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &file);
|
||||
void WriteToData(Data &data, uint64_t image_base);
|
||||
private:
|
||||
void ParseMinGW(PEArchitecture &file, uint64_t address, uint64_t start, uint64_t end);
|
||||
PERelocation *Add(uint64_t address, uint64_t source, OperandSize size, uint32_t addend);
|
||||
uint64_t address_;
|
||||
uint64_t mem_address_;
|
||||
|
||||
// no assignment op
|
||||
PERelocationList &operator =(const PERelocationList &);
|
||||
};
|
||||
|
||||
class PESEHandler : public BaseSEHandler
|
||||
{
|
||||
public:
|
||||
explicit PESEHandler(ISEHandlerList *owner, uint64_t address);
|
||||
explicit PESEHandler(ISEHandlerList *owner, const PESEHandler &src);
|
||||
virtual PESEHandler *Clone(ISEHandlerList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual void set_address(uint64_t address) { address_ = address; }
|
||||
virtual bool is_deleted() const { return deleted_; }
|
||||
virtual void set_deleted(bool deleted) { deleted_ = deleted; }
|
||||
void Rebase(uint64_t delta_base);
|
||||
private:
|
||||
uint64_t address_;
|
||||
bool deleted_;
|
||||
};
|
||||
|
||||
class PESEHandlerList : public BaseSEHandlerList
|
||||
{
|
||||
public:
|
||||
explicit PESEHandlerList();
|
||||
explicit PESEHandlerList(const PESEHandlerList &src);
|
||||
virtual PESEHandlerList *Clone() const;
|
||||
PESEHandler *item(size_t index) const;
|
||||
virtual PESEHandler *Add(uint64_t address);
|
||||
void Rebase(uint64_t delta_base);
|
||||
void Pack();
|
||||
};
|
||||
|
||||
class PECFGAddressTable;
|
||||
|
||||
class PECFGAddress : public IObject
|
||||
{
|
||||
public:
|
||||
explicit PECFGAddress(PECFGAddressTable *owner, uint64_t address);
|
||||
explicit PECFGAddress(PECFGAddressTable *owner, const PECFGAddress &src);
|
||||
~PECFGAddress();
|
||||
PECFGAddress *Clone(PECFGAddressTable *owner) const;
|
||||
void Rebase(uint64_t delta_base);
|
||||
uint64_t address() const { return address_; }
|
||||
void set_data(std::vector<uint8_t> value) { data_ = value; }
|
||||
std::vector<uint8_t> data() const { return data_; }
|
||||
private:
|
||||
PECFGAddressTable *owner_;
|
||||
uint64_t address_;
|
||||
std::vector<uint8_t> data_;
|
||||
};
|
||||
|
||||
class PECFGAddressTable : public ObjectList<PECFGAddress>
|
||||
{
|
||||
public:
|
||||
explicit PECFGAddressTable();
|
||||
explicit PECFGAddressTable(const PECFGAddressTable &src);
|
||||
PECFGAddressTable *Clone() const;
|
||||
PECFGAddress *Add(uint64_t address);
|
||||
void Rebase(uint64_t delta_base);
|
||||
};
|
||||
|
||||
class PELoadConfigDirectory : public IObject
|
||||
{
|
||||
public:
|
||||
explicit PELoadConfigDirectory();
|
||||
explicit PELoadConfigDirectory(const PELoadConfigDirectory &src);
|
||||
~PELoadConfigDirectory();
|
||||
virtual PELoadConfigDirectory *Clone() const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &dir);
|
||||
size_t WriteToFile(PEArchitecture &file);
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
void Rebase(uint64_t delta_base);
|
||||
uint64_t security_cookie() const { return security_cookie_; }
|
||||
void set_security_cookie(uint64_t value) { security_cookie_ = value; }
|
||||
uint64_t cfg_check_function() const { return cfg_check_function_; }
|
||||
void set_cfg_check_function(uint64_t value) { cfg_check_function_ = value; }
|
||||
PESEHandlerList *seh_handler_list() const { return seh_handler_list_; }
|
||||
PECFGAddressTable *cfg_address_list() const { return cfg_address_list_; }
|
||||
uint64_t seh_table_address() const { return seh_table_address_; }
|
||||
uint64_t cfg_table_address() const { return cfg_table_address_; }
|
||||
private:
|
||||
uint64_t seh_table_address_;
|
||||
uint64_t security_cookie_;
|
||||
uint64_t cfg_table_address_;
|
||||
uint64_t cfg_check_function_;
|
||||
uint32_t guard_flags_;
|
||||
PESEHandlerList *seh_handler_list_;
|
||||
PECFGAddressTable *cfg_address_list_;
|
||||
|
||||
// no assignment op
|
||||
PELoadConfigDirectory &operator =(const PELoadConfigDirectory &);
|
||||
};
|
||||
|
||||
enum PEResourceType {
|
||||
rtUnknown,
|
||||
rtCursor = 1,
|
||||
rtBitmap = 2,
|
||||
rtIcon = 3,
|
||||
rtMenu = 4,
|
||||
rtDialog = 5,
|
||||
rtStringTable = 6,
|
||||
rtFontDir = 7,
|
||||
rtFont = 8,
|
||||
rtAccelerators = 9,
|
||||
rtRCData = 10,
|
||||
rtMessageTable = 11,
|
||||
rtGroupCursor = 12,
|
||||
rtGroupIcon = 14,
|
||||
rtVersionInfo = 16,
|
||||
rtDlgInclude = 17,
|
||||
rtPlugPlay = 19,
|
||||
rtVXD = 20,
|
||||
rtAniCursor = 21,
|
||||
rtAniIcon = 22,
|
||||
rtHTML = 23,
|
||||
rtManifest = 24,
|
||||
rtDialogInit = 240,
|
||||
rtToolbar = 241
|
||||
};
|
||||
|
||||
class PEResource : public BaseResource
|
||||
{
|
||||
public:
|
||||
explicit PEResource(IResource *owner, PEResourceType type, uint32_t name_offset, uint32_t data_offset);
|
||||
explicit PEResource(IResource *owner, const PEResource &src);
|
||||
virtual PEResource *Clone(IResource *owner) const;
|
||||
PEResource *item(size_t index) const;
|
||||
virtual uint32_t type() const { return type_; }
|
||||
virtual uint64_t address() const { return is_directory() ? 0 : address_; }
|
||||
virtual size_t size() const { return is_directory() ? 0 : data_.item.Size; }
|
||||
virtual std::string name() const { return has_name() ? "\"" + name_ + "\"" : name_; }
|
||||
virtual bool is_directory() const { return (data_offset_ & IMAGE_RESOURCE_DATA_IS_DIRECTORY) != 0; }
|
||||
virtual PEResource *GetResourceByName(const std::string &name) const;
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
bool has_name() const { return (name_offset_ & IMAGE_RESOURCE_NAME_IS_STRING) != 0; }
|
||||
bool need_store() const;
|
||||
virtual std::string id() const;
|
||||
void ReadFromFile(PEArchitecture &file, uint64_t root_address);
|
||||
// PE format
|
||||
void WriteHeader(Data &data);
|
||||
void WriteEntry(Data &data);
|
||||
void WriteName(Data &data);
|
||||
size_t WriteData(Data &data, PEArchitecture &file);
|
||||
// ResourceManager format
|
||||
void WriteHeader(IFunction &data);
|
||||
void WriteEntry(IFunction &data);
|
||||
void WriteName(IFunction &data, size_t root_index, uint32_t key);
|
||||
void WriteData(IFunction &data, PEArchitecture &file, uint32_t key);
|
||||
private:
|
||||
PEResource *Add(PEResourceType type, uint32_t name_offset, uint32_t data_offset);
|
||||
|
||||
PEResourceType type_;
|
||||
uint32_t name_offset_;
|
||||
uint32_t data_offset_;
|
||||
union {
|
||||
IMAGE_RESOURCE_DIRECTORY dir;
|
||||
IMAGE_RESOURCE_DATA_ENTRY item;
|
||||
} data_;
|
||||
std::string name_;
|
||||
uint64_t address_;
|
||||
size_t entry_offset_;
|
||||
size_t data_entry_offset_;
|
||||
};
|
||||
|
||||
class PEResourceList : public BaseResourceList
|
||||
{
|
||||
public:
|
||||
explicit PEResourceList(PEArchitecture *owner);
|
||||
explicit PEResourceList(PEArchitecture *owner, const PEResourceList &src);
|
||||
|
||||
using BaseResourceList::Clone;
|
||||
PEResourceList *Clone(PEArchitecture *owner) const;
|
||||
PEResource *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &dir);
|
||||
size_t WriteToFile(PEArchitecture &file, uint64_t address);
|
||||
void Compile(PEArchitecture &file, bool for_packing);
|
||||
size_t size() const { return data_.size(); }
|
||||
size_t store_size() const { return store_size_; }
|
||||
void WritePackData(Data &data);
|
||||
void CreateCommands(PEArchitecture &file, IFunction &data);
|
||||
private:
|
||||
PEResource *Add(PEResourceType type, uint32_t name_offset, uint32_t data_offset);
|
||||
IMAGE_RESOURCE_DIRECTORY dir_;
|
||||
Data data_;
|
||||
std::vector<size_t> link_list_;
|
||||
size_t store_size_;
|
||||
};
|
||||
|
||||
class PERuntimeFunction : public BaseRuntimeFunction
|
||||
{
|
||||
public:
|
||||
explicit PERuntimeFunction(PERuntimeFunctionList *owner, uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address);
|
||||
explicit PERuntimeFunction(PERuntimeFunctionList *owner, const PERuntimeFunction &src);
|
||||
virtual PERuntimeFunction *Clone(IRuntimeFunctionList *owner) const;
|
||||
virtual uint64_t address() const { return address_; }
|
||||
virtual uint64_t begin() const { return begin_; }
|
||||
virtual uint64_t end() const { return end_; }
|
||||
virtual uint64_t unwind_address() const { return unwind_address_; }
|
||||
virtual void set_begin(uint64_t begin) { begin_ = begin; }
|
||||
virtual void set_end(uint64_t end) { end_ = end; }
|
||||
virtual void set_unwind_address(uint64_t unwind_address) { unwind_address_ = unwind_address; }
|
||||
virtual void Rebase(uint64_t delta_base);
|
||||
virtual void Parse(IArchitecture &file, IFunction &dest);
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint64_t begin_;
|
||||
uint64_t end_;
|
||||
uint64_t unwind_address_;
|
||||
};
|
||||
|
||||
class PERuntimeFunctionList : public BaseRuntimeFunctionList
|
||||
{
|
||||
public:
|
||||
explicit PERuntimeFunctionList();
|
||||
explicit PERuntimeFunctionList(const PERuntimeFunctionList &src);
|
||||
PERuntimeFunctionList *Clone() const;
|
||||
PERuntimeFunction *item(size_t index) const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &directory);
|
||||
size_t WriteToFile(PEArchitecture &file);
|
||||
virtual PERuntimeFunction *Add(uint64_t address, uint64_t begin, uint64_t end, uint64_t unwind_address, IRuntimeFunction *source, const std::vector<uint8_t> &call_frame_instructions);
|
||||
virtual PERuntimeFunction *GetFunctionByAddress(uint64_t address) const;
|
||||
void RebaseByFile(IArchitecture &file, uint64_t target_image_base, uint64_t delta_base);
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
uint64_t address() const { return address_; }
|
||||
private:
|
||||
uint64_t RebaseDWord(IArchitecture &file, uint32_t delta_base);
|
||||
uint64_t address_;
|
||||
|
||||
// no assignment op
|
||||
PERuntimeFunctionList &operator =(const PERuntimeFunctionList &);
|
||||
};
|
||||
|
||||
class PETLSDirectory : public ReferenceList
|
||||
{
|
||||
public:
|
||||
explicit PETLSDirectory();
|
||||
explicit PETLSDirectory(const PETLSDirectory &src);
|
||||
PETLSDirectory *Clone() const;
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &directory);
|
||||
void FreeByManager(MemoryManager &manager);
|
||||
uint64_t address() const { return address_; }
|
||||
uint64_t start_address_of_raw_data() const { return start_address_of_raw_data_; }
|
||||
uint64_t end_address_of_raw_data() const { return end_address_of_raw_data_; }
|
||||
uint64_t address_of_index() const { return address_of_index_; }
|
||||
uint64_t address_of_call_backs() const { return address_of_call_backs_; }
|
||||
uint32_t size_of_zero_fill() const { return size_of_zero_fill_; }
|
||||
uint32_t characteristics() const { return characteristics_; }
|
||||
void set_start_address_of_raw_data(uint64_t value) { start_address_of_raw_data_ = value; }
|
||||
void set_end_address_of_raw_data(uint64_t value) { end_address_of_raw_data_ = value; }
|
||||
private:
|
||||
uint64_t address_;
|
||||
uint64_t start_address_of_raw_data_;
|
||||
uint64_t end_address_of_raw_data_;
|
||||
uint64_t address_of_index_;
|
||||
uint64_t address_of_call_backs_;
|
||||
uint32_t size_of_zero_fill_;
|
||||
uint32_t characteristics_;
|
||||
|
||||
// no assignment op
|
||||
PETLSDirectory &operator =(const PETLSDirectory &);
|
||||
};
|
||||
|
||||
class PEDebugDirectory;
|
||||
|
||||
class PEDebugData : public IObject
|
||||
{
|
||||
public:
|
||||
explicit PEDebugData(PEDebugDirectory *owner);
|
||||
explicit PEDebugData(PEDebugDirectory *owner, const PEDebugData &src);
|
||||
~PEDebugData();
|
||||
PEDebugData *Clone(PEDebugDirectory *owner) const;
|
||||
void ReadFromFile(PEArchitecture &file);
|
||||
void WriteToFile(PEArchitecture &file);
|
||||
uint64_t address() const { return address_; }
|
||||
uint32_t offset() const { return offset_; }
|
||||
uint32_t size() const { return size_; }
|
||||
uint32_t type() const { return type_; }
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
void set_offset(uint32_t offset) { offset_ = offset; }
|
||||
private:
|
||||
PEDebugDirectory *owner_;
|
||||
uint32_t characteristics_;
|
||||
uint32_t time_date_stamp_;
|
||||
uint16_t major_version_;
|
||||
uint16_t minor_version_;
|
||||
uint32_t type_;
|
||||
uint32_t size_;
|
||||
uint64_t address_;
|
||||
uint32_t offset_;
|
||||
};
|
||||
|
||||
class PEDebugDirectory : public ObjectList<PEDebugData>
|
||||
{
|
||||
public:
|
||||
explicit PEDebugDirectory();
|
||||
explicit PEDebugDirectory(const PEDebugDirectory &src);
|
||||
PEDebugDirectory *Clone() const;
|
||||
uint64_t address() const { return address_; }
|
||||
void ReadFromFile(PEArchitecture &file, PEDirectory &directory);
|
||||
void WriteToFile(PEArchitecture &file);
|
||||
void FreeByManager(MemoryManager &manager) const;
|
||||
private:
|
||||
PEDebugData *Add();
|
||||
uint64_t address_;
|
||||
|
||||
// not impl
|
||||
PEDebugDirectory &operator =(const PEDebugDirectory &);
|
||||
};
|
||||
|
||||
class pdb_reader;
|
||||
|
||||
class PDBFile : public BaseMapFile
|
||||
{
|
||||
public:
|
||||
explicit PDBFile();
|
||||
virtual bool Parse(const char *file_name, const std::vector<uint64_t> &segments);
|
||||
virtual std::string file_name() const { return file_name_; }
|
||||
virtual uint64_t time_stamp() const { return time_stamp_; }
|
||||
std::vector<uint8_t> guid() const { return guid_; }
|
||||
void set_time_stamp(uint64_t value) { time_stamp_ = value; }
|
||||
private:
|
||||
bool ReadSymbols(pdb_reader &reader);
|
||||
void codeview_dump_symbols(const std::vector<uint8_t> &root, size_t offset);
|
||||
std::string GetTypeName(size_t type, const std::string &name);
|
||||
void AddSymbol(size_t segment, size_t offset, const std::string &name);
|
||||
void AddSection(size_t segment, size_t offset, uint64_t size, const std::string &name);
|
||||
|
||||
std::string file_name_;
|
||||
uint64_t time_stamp_;
|
||||
std::vector<uint8_t> guid_;
|
||||
std::vector<uint64_t> segments_;
|
||||
size_t types_first_index_;
|
||||
std::vector<uint8_t> types_data_;
|
||||
std::vector<const union codeview_type *> types_offset_;
|
||||
std::set<std::pair<uint64_t, std::string> > map_;
|
||||
};
|
||||
|
||||
class COFFStringTable
|
||||
{
|
||||
public:
|
||||
std::string GetString(uint32_t pos) const;
|
||||
void ReadFromFile(PEArchitecture &file);
|
||||
void ReadFromFile(FileStream &file);
|
||||
private:
|
||||
std::vector<char> data_;
|
||||
};
|
||||
|
||||
class COFFFile : public BaseMapFile
|
||||
{
|
||||
public:
|
||||
bool Parse(const char *file_name, const std::vector<uint64_t> &segments);
|
||||
virtual std::string file_name() const { return file_name_; }
|
||||
virtual uint64_t time_stamp() const { return time_stamp_; }
|
||||
private:
|
||||
void AddSymbol(size_t segment, size_t offset, const std::string &name);
|
||||
uint64_t time_stamp_;
|
||||
std::string file_name_;
|
||||
std::vector<uint64_t> segments_;
|
||||
};
|
||||
|
||||
class PEFile;
|
||||
|
||||
enum ImageType {
|
||||
itExe,
|
||||
itLibrary,
|
||||
itDriver
|
||||
};
|
||||
|
||||
class PEArchitecture : public BaseArchitecture
|
||||
{
|
||||
public:
|
||||
explicit PEArchitecture(PEFile *owner, uint64_t offset, uint64_t size);
|
||||
explicit PEArchitecture(PEFile *owner, const PEArchitecture &src);
|
||||
virtual ~PEArchitecture();
|
||||
virtual PEArchitecture *Clone(IFile *file) const;
|
||||
OpenStatus ReadFromFile(uint32_t mode);
|
||||
virtual void ReadFromBuffer(Buffer &buffer);
|
||||
void WriteCheckSum();
|
||||
virtual bool WriteToFile();
|
||||
virtual bool is_executable() const;
|
||||
virtual std::string name() const;
|
||||
virtual uint32_t type() const { return cpu_; }
|
||||
virtual OperandSize cpu_address_size() const { return cpu_address_size_; }
|
||||
virtual uint64_t entry_point() const { return entry_point_; }
|
||||
void set_entry_point(uint64_t entry_point) { entry_point_ = entry_point; }
|
||||
virtual uint32_t segment_alignment() const { return segment_alignment_; }
|
||||
virtual uint32_t file_alignment() const { return file_alignment_; }
|
||||
virtual uint64_t image_base() const { return image_base_; }
|
||||
virtual PEDirectoryList *command_list() const { return directory_list_; }
|
||||
virtual PESegmentList *segment_list() const { return segment_list_; }
|
||||
virtual PESectionList *section_list() const { return section_list_; }
|
||||
virtual PEImportList *import_list() const { return import_list_; }
|
||||
virtual PEExportList *export_list() const { return export_list_; }
|
||||
virtual PEFixupList *fixup_list() const { return fixup_list_; }
|
||||
virtual PERelocationList *relocation_list() const { return relocation_list_; }
|
||||
virtual PEResourceList *resource_list() const { return resource_list_; }
|
||||
virtual PESEHandlerList *seh_handler_list() const { return load_config_directory_->seh_handler_list(); }
|
||||
PETLSDirectory *tls_directory() const { return tls_directory_; }
|
||||
PELoadConfigDirectory *load_config_directory() const { return load_config_directory_; }
|
||||
PEDelayImportList *delay_import_list() const { return delay_import_list_; }
|
||||
virtual IFunctionList *function_list() const { return function_list_; }
|
||||
virtual IVirtualMachineList *virtual_machine_list() const { return virtual_machine_list_; }
|
||||
virtual PERuntimeFunctionList *runtime_function_list() const { return runtime_function_list_; }
|
||||
virtual bool Compile(CompileOptions &options, IArchitecture *runtime);
|
||||
virtual void Save(CompileContext &ctx);
|
||||
ImageType image_type() const { return image_type_; }
|
||||
void Rebase(uint64_t target_image_base, uint64_t delta_base);
|
||||
virtual CallingConvention calling_convention() const { return (cpu_address_size() == osDWord) ? ccStdcall : ccMSx64; }
|
||||
virtual uint64_t time_stamp() const { return time_stamp_; }
|
||||
PESegment *resource_section() const { return resource_section_; }
|
||||
PESegment *fixup_section() const { return fixup_section_; }
|
||||
uint32_t header_offset() const { return header_offset_; }
|
||||
uint32_t header_size() const { return header_size_; }
|
||||
virtual std::string ANSIToUTF8(const std::string &str) const;
|
||||
uint16_t dll_characteristics() const { return dll_characteristics_; }
|
||||
std::string pdb_file_name() const;
|
||||
uint32_t operating_system_version() const { return operating_system_version_; }
|
||||
protected:
|
||||
virtual bool Prepare(CompileContext &ctx);
|
||||
virtual bool ReadMapFile(IMapFile &map_file);
|
||||
private:
|
||||
enum {
|
||||
MIN_HEADER_OFFSET = 0x80
|
||||
};
|
||||
PEDirectoryList *directory_list_;
|
||||
PESegmentList *segment_list_;
|
||||
PESectionList *section_list_;
|
||||
PEImportList *import_list_;
|
||||
PEExportList *export_list_;
|
||||
PEFixupList *fixup_list_;
|
||||
PERelocationList *relocation_list_;
|
||||
IFunctionList *function_list_;
|
||||
PEResourceList *resource_list_;
|
||||
PELoadConfigDirectory *load_config_directory_;
|
||||
IVirtualMachineList *virtual_machine_list_;
|
||||
PERuntimeFunctionList *runtime_function_list_;
|
||||
PETLSDirectory *tls_directory_;
|
||||
PEDebugDirectory *debug_directory_;
|
||||
PEDelayImportList *delay_import_list_;
|
||||
uint32_t cpu_;
|
||||
OperandSize cpu_address_size_;
|
||||
uint64_t time_stamp_;
|
||||
uint64_t entry_point_;
|
||||
uint64_t image_base_;
|
||||
uint32_t header_offset_;
|
||||
uint32_t header_size_;
|
||||
uint32_t segment_alignment_;
|
||||
uint32_t file_alignment_;
|
||||
PESegment *resource_section_;
|
||||
PESegment *fixup_section_;
|
||||
size_t optimized_section_count_;
|
||||
ImageType image_type_;
|
||||
uint16_t characterictics_;
|
||||
uint32_t check_sum_;
|
||||
uint32_t low_resize_header_;
|
||||
uint32_t resize_header_;
|
||||
uint32_t operating_system_version_;
|
||||
uint32_t subsystem_version_;
|
||||
uint16_t dll_characteristics_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
PEArchitecture(const PEArchitecture &);
|
||||
PEArchitecture &operator =(const PEArchitecture &);
|
||||
};
|
||||
|
||||
class NETArchitecture;
|
||||
|
||||
class PEFile : public IFile
|
||||
{
|
||||
public:
|
||||
explicit PEFile(ILog *log = NULL);
|
||||
explicit PEFile(const PEFile &src, const char *file_name);
|
||||
virtual ~PEFile();
|
||||
virtual std::string format_name() const;
|
||||
virtual PEFile *Clone(const char *file_name) const;
|
||||
virtual bool Compile(CompileOptions &options);
|
||||
virtual std::string version() const;
|
||||
virtual bool is_executable() const;
|
||||
virtual uint32_t disable_options() const;
|
||||
bool GetCheckSum(uint32_t *check_sum);
|
||||
PEArchitecture *arch_pe() const { return count() > 0 ? dynamic_cast<PEArchitecture *>(item(0)) : NULL; }
|
||||
virtual std::string exec_command() const;
|
||||
protected:
|
||||
virtual OpenStatus ReadHeader(uint32_t open_mode);
|
||||
bool WriteHeader();
|
||||
virtual IFile *runtime() const { return runtime_; };
|
||||
private:
|
||||
PEFile *runtime_;
|
||||
|
||||
// no copy ctr or assignment op
|
||||
PEFile(const PEFile &);
|
||||
PEFile &operator =(const PEFile &);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
#ifndef CORE_PCH
|
||||
#define CORE_PCH
|
||||
|
||||
#include "../runtime/precommon.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <assert.h>
|
||||
#include <unordered_map>
|
||||
#include <queue>
|
||||
#include <time.h>
|
||||
#include <memory>
|
||||
|
||||
#ifdef VMP_GNU
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#ifdef __APPLE__
|
||||
#include <copyfile.h>
|
||||
#include <crt_externs.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_vm.h>
|
||||
#include <sys/syslimits.h>
|
||||
#else
|
||||
#include <memory>
|
||||
#ifndef O_EXLOCK // not available at linux
|
||||
#define O_EXLOCK 0
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/mman.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#define DUMMYUNIONNAME u
|
||||
#define DUMMYUNIONNAME2 u2
|
||||
#define DUMMYUNIONNAME3 u3
|
||||
#define DUMMYUNIONNAME4 u4
|
||||
#define DUMMYUNIONNAME5 u5
|
||||
#define DUMMYUNIONNAME6 u6
|
||||
#define DUMMYUNIONNAME7 u7
|
||||
#define DUMMYUNIONNAME8 u8
|
||||
#define DUMMYUNIONNAME9 u9
|
||||
|
||||
#define DUMMYSTRUCTNAME s
|
||||
#define DUMMYSTRUCTNAME2 s2
|
||||
#define DUMMYSTRUCTNAME3 s3
|
||||
#define DUMMYSTRUCTNAME4 s4
|
||||
#define DUMMYSTRUCTNAME5 s5
|
||||
|
||||
#else
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <io.h>
|
||||
|
||||
#define isatty _isatty
|
||||
#define fileno _fileno
|
||||
|
||||
#endif
|
||||
|
||||
#include "pe.h"
|
||||
#include "mach-o.h"
|
||||
#include "elf.h"
|
||||
#include "../third-party/tinyxml/tinyxml.h"
|
||||
|
||||
#endif //CORE_PCH
|
||||
+1059
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,943 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Document>
|
||||
<Protection InputFileName="../bin/64/Release/win_runtime.dll" Options="0" OutputFileName="win_runtime32.dll">
|
||||
<Messages />
|
||||
<Folders />
|
||||
<Procedures />
|
||||
<Objects />
|
||||
</Protection>
|
||||
<Script>
|
||||
<![CDATA[function OnBeforeSaveFile()
|
||||
local file = vmprotect.core():outputArchitecture()
|
||||
local functions = vmprotect.core():inputArchitecture():functions()
|
||||
local empty_byte
|
||||
local is_dotnet
|
||||
if (file:name() == ".NET") then
|
||||
is_dotnet = true
|
||||
empty_byte = 0x2a
|
||||
else
|
||||
is_dotnet = false
|
||||
empty_byte = 0xcc
|
||||
end
|
||||
for i = 1, functions:count() do
|
||||
local func = functions:item(i)
|
||||
if (not func:needCompile() and func:type() ~= ObjectType.String) then
|
||||
local block_size = 0;
|
||||
local block_address = 0;
|
||||
for j = 1, func:count() do
|
||||
command = func:item(j)
|
||||
need_clear = bit32.btest(command:options(), CommandOption.ClearOriginalCode)
|
||||
if (need_clear and is_dotnet and command:type() == ILCommandType.Comment) then
|
||||
need_clear = false
|
||||
end
|
||||
if need_clear then
|
||||
if (is_dotnet) then
|
||||
-- IL
|
||||
else
|
||||
-- Intel
|
||||
for k = 1, 3 do
|
||||
operand = command:operand(k)
|
||||
if operand:fixup() then
|
||||
local fixup = file:fixups():itemByAddress(operand:fixup():address())
|
||||
if fixup then
|
||||
fixup:setDeleted(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if block_address ~= 0 and (block_address + block_size) ~= command:address() then
|
||||
if block_size > 0 then
|
||||
if file:addressSeek(block_address) then
|
||||
local s = string.rep(string.char(empty_byte), block_size)
|
||||
file:write(s)
|
||||
end
|
||||
end
|
||||
block_address = 0
|
||||
block_size = 0
|
||||
end
|
||||
|
||||
if block_address == 0 then
|
||||
block_address = command:address()
|
||||
end
|
||||
block_size = block_size + command:size()
|
||||
end
|
||||
end
|
||||
|
||||
if block_size > 0 then
|
||||
if file:addressSeek(block_address) then
|
||||
local s = string.rep(string.char(empty_byte), block_size)
|
||||
file:write(s)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
file:exports():clear()
|
||||
end
|
||||
|
||||
function OnAfterCompilation()
|
||||
local array_name = string.gsub(string.gsub(vmprotect.extractFileName(core:outputFileName()), "%.", "_"), "demo", "")
|
||||
|
||||
local lines = {}
|
||||
table.insert(lines, string.format('const uint8_t %s_code[] = {', array_name))
|
||||
local s = ""
|
||||
for i = 1, code_data:len() do
|
||||
s = s .. string.format("0x%.2x, ", code_data:byte(i))
|
||||
if (s:len() > 100) then
|
||||
table.insert(lines, s)
|
||||
s = ""
|
||||
end
|
||||
end
|
||||
if (s:len() > 0) then
|
||||
table.insert(lines, s)
|
||||
end
|
||||
table.insert(lines, "};")
|
||||
|
||||
local stream = io.open(core:outputFileName(), "rb")
|
||||
local file_data = stream:read("*all")
|
||||
stream:close()
|
||||
|
||||
table.insert(lines, string.format('const uint8_t %s_file[] = {', array_name))
|
||||
local key = math.random(0x100000000);
|
||||
local key_data = DWordToChar(key);
|
||||
s = ""
|
||||
for i = 1, key_data:len() do
|
||||
s = s .. string.format("0x%.2x, ", key_data:byte(i))
|
||||
end
|
||||
for i = 0, file_data:len() - 1 do
|
||||
s = s .. string.format("0x%.2x, ", bit32.bxor(file_data:byte(i + 1), (bit32.lrotate(key, i) + i) % 0x100))
|
||||
if (s:len() > 100) then
|
||||
table.insert(lines, s)
|
||||
s = ""
|
||||
end
|
||||
end
|
||||
if (s:len() > 0) then
|
||||
table.insert(lines, s)
|
||||
end
|
||||
table.insert(lines, "};")
|
||||
|
||||
local stream = io.open(core:outputFileName() .. ".inc", "w+")
|
||||
stream:write(table.concat(lines, "\n"))
|
||||
stream:close()
|
||||
end
|
||||
|
||||
function ValueToChar(val, len)
|
||||
local value = ""
|
||||
if (type(val) == "userdata") then
|
||||
value = tostring(val)
|
||||
else
|
||||
if (val < 0) then
|
||||
val = 0x10000 + val
|
||||
end
|
||||
value = string.format("%x", val)
|
||||
end
|
||||
while (value:len() < len * 2) do
|
||||
value = "0" .. value
|
||||
end
|
||||
|
||||
local res = ""
|
||||
for i = value:len() - 1, 1, -2 do
|
||||
res = res .. string.char(tonumber("0x" .. value:sub(i, i + 1)))
|
||||
len = len - 1
|
||||
if (len == 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function ByteToChar(value)
|
||||
return ValueToChar(value, 1)
|
||||
end
|
||||
|
||||
function WordToChar(value)
|
||||
return ValueToChar(value, 2)
|
||||
end
|
||||
|
||||
function DWordToChar(value)
|
||||
return ValueToChar(value, 4)
|
||||
end
|
||||
|
||||
function QWordToChar(value)
|
||||
return ValueToChar(value, 8)
|
||||
end
|
||||
|
||||
function Ord(value)
|
||||
if (value) then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function OnBeforeCompilation()
|
||||
local file = core:outputArchitecture()
|
||||
if (file:name() == ".NET") then
|
||||
local rsrc = file:segments():itemByName(".rsrc")
|
||||
if (rsrc) then
|
||||
rsrc:destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
core = vmprotect.core()
|
||||
file = core:inputFile():item(core:inputFile():count())
|
||||
|
||||
procedure_lines = {}
|
||||
--[[
|
||||
# format: procname XYZ
|
||||
#
|
||||
# X:
|
||||
# A - All features
|
||||
# L - Licensing system
|
||||
# B - Bundler
|
||||
# R - Registry
|
||||
# E - rEsources
|
||||
# I - Loader
|
||||
# P - Processor
|
||||
#
|
||||
# Y:
|
||||
# M - Mutation
|
||||
# F - Fast virtualization
|
||||
# V - Virtualization (default)
|
||||
#
|
||||
# Z:
|
||||
# N - None entry point
|
||||
# R - Random entry point
|
||||
#
|
||||
]]--
|
||||
if (file:name() == ".NET") then
|
||||
-- Virtual Machine
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine::.ctor( PM')
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine::Invoke( PM')
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine/Utils::Random( AVN')
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine/Utils::CalcCRC( AVN')
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine:: PM')
|
||||
table.insert(procedure_lines, 'VMProtect.VirtualMachine/ PM')
|
||||
-- Crypto
|
||||
table.insert(procedure_lines, 'VMProtect.CipherRC5:: AM')
|
||||
-- Core
|
||||
table.insert(procedure_lines, 'VMProtect.Core::Init( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::IsProtected( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::IsDebuggerPresent( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::FindFirmwareVendor( AM')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::IsVirtualMachinePresent( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::IsValidImageCRC( AM')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::DecryptString( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::FreeString( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::AntidebugThread( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::SetSerialNumber( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::GetSerialNumberState( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::GetSerialNumberData( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::GetCurrentHWID( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::ActivateLicense( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::DeactivateLicense( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::GetOfflineActivationString( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::GetOfflineDeactivationString( LV')
|
||||
table.insert(procedure_lines, 'VMProtect.Core::DecryptBuffer( LVN')
|
||||
-- CpuId
|
||||
table.insert(procedure_lines, 'VMProtect.CpuId::Invoke( AV')
|
||||
-- String Manager
|
||||
table.insert(procedure_lines, 'VMProtect.StringManager::.ctor( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.StringManager:: AVN')
|
||||
-- Resource Manager
|
||||
table.insert(procedure_lines, 'VMProtect.ResourceManager::.ctor( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.ResourceManager::DecryptData( AM')
|
||||
table.insert(procedure_lines, 'VMProtect.ResourceManager:: AV')
|
||||
-- HardwareID
|
||||
table.insert(procedure_lines, 'VMProtect.HardwareID::.ctor( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.HardwareID::ToString( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.HardwareID:: AVN')
|
||||
-- Licensing Manager
|
||||
table.insert(procedure_lines, 'VMProtect.LicensingManager::.ctor( AV')
|
||||
table.insert(procedure_lines, 'VMProtect.LicensingManager:: LVN')
|
||||
table.insert(procedure_lines, 'VMProtect.LicensingManager/ActivationRequest:: LV')
|
||||
table.insert(procedure_lines, 'VMProtect.LicensingManager/DeactivationRequest:: LV')
|
||||
table.insert(procedure_lines, 'VMProtect.LicensingManager/BaseRequest::Send( LV')
|
||||
-- Loader
|
||||
table.insert(procedure_lines, 'VMProtect.Loader::FindFirmwareVendor( IM')
|
||||
table.insert(procedure_lines, 'VMProtect.Loader:: IVN')
|
||||
table.insert(procedure_lines, 'VMProtect.GlobalData::Set IVN')
|
||||
table.insert(procedure_lines, 'VMProtect.GlobalData:: IV')
|
||||
table.insert(procedure_lines, 'SevenZip.Compression. IM')
|
||||
table.insert(procedure_lines, 'VMProtect.Win32::GetProcAddress( IM')
|
||||
table.insert(procedure_lines, 'VMProtect.Win32:: IV')
|
||||
table.insert(procedure_lines, 'VMProtect.Win32/ IV')
|
||||
else
|
||||
-- Crypto
|
||||
table.insert(procedure_lines, 'RC5Key:: A')
|
||||
table.insert(procedure_lines, 'CipherRC5::CipherRC5( A')
|
||||
table.insert(procedure_lines, 'CipherRC5::Encrypt( AM')
|
||||
table.insert(procedure_lines, 'CipherRC5::Decrypt( AM')
|
||||
table.insert(procedure_lines, 'CryptoContainer:: A')
|
||||
table.insert(procedure_lines, 'SHA1:: A')
|
||||
table.insert(procedure_lines, 'BigNumber::internal_mul( LMR')
|
||||
table.insert(procedure_lines, 'BigNumber::internal_mod( LMR')
|
||||
table.insert(procedure_lines, 'BigNumber:: LVN')
|
||||
table.insert(procedure_lines, 'CalcCRC( AM')
|
||||
-- Strings
|
||||
table.insert(procedure_lines, 'string "')
|
||||
-- Core
|
||||
table.insert(procedure_lines, 'Core:: AV')
|
||||
table.insert(procedure_lines, 'DllMain AV')
|
||||
table.insert(procedure_lines, '_DllMain AV')
|
||||
table.insert(procedure_lines, 'InternalGetProcAddress( A')
|
||||
table.insert(procedure_lines, 'ShowMessage( AV')
|
||||
table.insert(procedure_lines, 'ExportedIsValidImageCRC AVR')
|
||||
table.insert(procedure_lines, 'CRCData::CRCData( AVN')
|
||||
table.insert(procedure_lines, 'InternalFindFirmwareVendor AM')
|
||||
table.insert(procedure_lines, 'ExportedIsVirtualMachinePresent AVR')
|
||||
table.insert(procedure_lines, 'ExportedIsDebuggerPresent AVR')
|
||||
table.insert(procedure_lines, 'ExportedIsProtected AVR')
|
||||
table.insert(procedure_lines, 'CoreData::CoreData( AVN')
|
||||
table.insert(procedure_lines, 'HookedNtProtectVirtualMemory( AM')
|
||||
table.insert(procedure_lines, 'HookedNtClose( AM')
|
||||
table.insert(procedure_lines, 'ExAllocateNonPagedPoolNx( AM')
|
||||
-- Loader
|
||||
table.insert(procedure_lines, 'SetupImage IVN')
|
||||
table.insert(procedure_lines, 'FreeImage IV')
|
||||
table.insert(procedure_lines, 'SETUP_IMAGE_DATA:: IVN')
|
||||
table.insert(procedure_lines, 'LoaderMessage IVN')
|
||||
table.insert(procedure_lines, 'Loader IM')
|
||||
table.insert(procedure_lines, 'Lzma IM')
|
||||
table.insert(procedure_lines, '_Lzma IM')
|
||||
-- String Manager
|
||||
table.insert(procedure_lines, 'VirtualString::VirtualString( AM')
|
||||
table.insert(procedure_lines, 'VirtualString:: AVN')
|
||||
table.insert(procedure_lines, 'VirtualStringList:: AVN')
|
||||
table.insert(procedure_lines, 'StringManager:: AVN')
|
||||
table.insert(procedure_lines, 'ExportedDecryptString AMR')
|
||||
table.insert(procedure_lines, 'ExportedFreeString AMR')
|
||||
-- Resource Manager
|
||||
table.insert(procedure_lines, 'VirtualResource::Decrypt( EM')
|
||||
table.insert(procedure_lines, 'VirtualResource:: EVN')
|
||||
table.insert(procedure_lines, 'VirtualResourceList:: EVN')
|
||||
table.insert(procedure_lines, 'ResourceManager:: EVN')
|
||||
table.insert(procedure_lines, 'HookedLdrFindResource_U( EM')
|
||||
table.insert(procedure_lines, 'HookedLdrAccessResource( EM')
|
||||
table.insert(procedure_lines, 'HookedLoadStringA( EM')
|
||||
table.insert(procedure_lines, 'HookedLoadStringW( EM')
|
||||
table.insert(procedure_lines, 'ExportedLoadResource EMR')
|
||||
table.insert(procedure_lines, 'ExportedFindResourceA EMR')
|
||||
table.insert(procedure_lines, 'ExportedFindResourceExA EMR')
|
||||
table.insert(procedure_lines, 'ExportedFindResourceW EMR')
|
||||
table.insert(procedure_lines, 'ExportedFindResourceExW EMR')
|
||||
table.insert(procedure_lines, 'ExportedLoadStringA EMR')
|
||||
table.insert(procedure_lines, 'ExportedLoadStringW EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceNamesA EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceNamesW EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceLanguagesA EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceLanguagesW EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceTypesA EMR')
|
||||
table.insert(procedure_lines, 'ExportedEnumResourceTypesW EMR')
|
||||
-- Licensing Manager
|
||||
table.insert(procedure_lines, 'LicensingManager:: L')
|
||||
table.insert(procedure_lines, 'ActivationRequest:: L')
|
||||
table.insert(procedure_lines, 'DeactivationRequest:: L')
|
||||
table.insert(procedure_lines, 'BaseRequest::Send( LVR')
|
||||
table.insert(procedure_lines, 'ExportedSetSerialNumber LVR')
|
||||
table.insert(procedure_lines, 'ExportedGetSerialNumberState LVR')
|
||||
table.insert(procedure_lines, 'ExportedGetSerialNumberData LVR')
|
||||
table.insert(procedure_lines, 'ExportedActivateLicense LVR')
|
||||
table.insert(procedure_lines, 'ExportedDeactivateLicense LVR')
|
||||
table.insert(procedure_lines, 'ExportedGetOfflineActivationString LVR')
|
||||
table.insert(procedure_lines, 'ExportedGetOfflineDeactivationString LVR')
|
||||
table.insert(procedure_lines, 'ExportedDecryptBuffer LVR')
|
||||
-- HardwareID
|
||||
table.insert(procedure_lines, 'HardwareID:: L')
|
||||
table.insert(procedure_lines, 'ExportedGetCurrentHWID LVR')
|
||||
-- File Manager
|
||||
table.insert(procedure_lines, 'FileManager::ReadFile( BM')
|
||||
table.insert(procedure_lines, 'FileManager::ReadImage( BM')
|
||||
table.insert(procedure_lines, 'FileManager:: BVN')
|
||||
table.insert(procedure_lines, 'HookedNtQueryAttributesFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtCreateFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtOpenFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtReadFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryInformationFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryVolumeInformationFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtSetInformationFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryDirectoryFile( BM')
|
||||
table.insert(procedure_lines, 'HookedNtCreateSection( BM')
|
||||
table.insert(procedure_lines, 'HookedNtQuerySection( BM')
|
||||
table.insert(procedure_lines, 'HookedNtMapViewOfSection( BM')
|
||||
table.insert(procedure_lines, 'HookedNtUnmapViewOfSection( BM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryVirtualMemory( BM')
|
||||
-- Registry Manager
|
||||
table.insert(procedure_lines, 'RegistryManager:: RM')
|
||||
table.insert(procedure_lines, 'RegistryKey:: RM')
|
||||
table.insert(procedure_lines, 'HookedNtSetValueKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtDeleteValueKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtCreateKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtOpenKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtOpenKeyEx( RM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryValueKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtDeleteKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtQueryKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtEnumerateValueKey( RM')
|
||||
table.insert(procedure_lines, 'HookedNtEnumerateKey( RM')
|
||||
-- Hook Manager
|
||||
table.insert(procedure_lines, 'HookManager:: AV')
|
||||
table.insert(procedure_lines, 'HookedAPI:: AVN')
|
||||
end
|
||||
|
||||
map_functions = file:mapFunctions()
|
||||
functions = file:functions()
|
||||
functions:clear()
|
||||
function_params = {}
|
||||
for _, line in ipairs(procedure_lines) do
|
||||
if (line:len() == 0 or line:sub(1, 1) == "#") then
|
||||
-- do nothing
|
||||
else
|
||||
i = line:find(" ")
|
||||
params = ""
|
||||
compilation_type = CompilationType.Virtualization
|
||||
if (i) then
|
||||
name = line:sub(1, i - 1)
|
||||
params = line:sub(i + 1)
|
||||
if (params:len() > 1) then
|
||||
if (params:sub(2, 2) == "M") then
|
||||
compilation_type = CompilationType.Mutation
|
||||
end
|
||||
end
|
||||
else
|
||||
name = line
|
||||
end
|
||||
is_found = false
|
||||
for i = 1, map_functions:count() do
|
||||
map_function = map_functions:item(i)
|
||||
if (map_function:name():sub(1, name:len()) == name) then
|
||||
is_found = true
|
||||
if (not functions:itemByAddress(map_function:address())) then
|
||||
func = functions:addByAddress(map_function:address(), compilation_type, false)
|
||||
if (func) then
|
||||
function_params[tostring(func:address())] = params
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if (not is_found) then
|
||||
print(string.format("%s not found!!!", name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
|
||||
code_data = ""
|
||||
|
||||
-- process exports
|
||||
|
||||
export_names = {}
|
||||
if (file:name() == ".NET") then
|
||||
table.insert(export_names, "void VMProtect.Loader::Main()")
|
||||
table.insert(export_names, "string VMProtect.Core::DecryptString()")
|
||||
table.insert(export_names, "string VMProtect.Core::DecryptString()")
|
||||
table.insert(export_names, "bool VMProtect.Core::FreeString(string&)")
|
||||
table.insert(export_names, "valuetype VMProtect.SerialState VMProtect.Core::SetSerialNumber(string)")
|
||||
table.insert(export_names, "valuetype VMProtect.SerialState VMProtect.Core::GetSerialNumberState()")
|
||||
table.insert(export_names, "bool VMProtect.Core::GetSerialNumberData(class VMProtect.SerialNumberData&)")
|
||||
table.insert(export_names, "string VMProtect.Core::GetCurrentHWID()")
|
||||
table.insert(export_names, "valuetype VMProtect.ActivationStatus VMProtect.Core::ActivateLicense(string, string&)")
|
||||
table.insert(export_names, "valuetype VMProtect.ActivationStatus VMProtect.Core::DeactivateLicense(string)")
|
||||
table.insert(export_names, "valuetype VMProtect.ActivationStatus VMProtect.Core::GetOfflineActivationString(string, string&)")
|
||||
table.insert(export_names, "valuetype VMProtect.ActivationStatus VMProtect.Core::GetOfflineDeactivationString(string, string&)")
|
||||
table.insert(export_names, "bool VMProtect.Core::IsValidImageCRC()")
|
||||
table.insert(export_names, "bool VMProtect.Core::IsDebuggerPresent(bool)")
|
||||
table.insert(export_names, "bool VMProtect.Core::IsVirtualMachinePresent()")
|
||||
table.insert(export_names, "unsigned int32 VMProtect.Core::DecryptBuffer(unsigned int32, unsigned int32, unsigned int32, unsigned int32)")
|
||||
table.insert(export_names, "bool VMProtect.Core::IsProtected()")
|
||||
table.insert(export_names, "unsigned int32 VMProtect.GlobalData::SessionKey()")
|
||||
table.insert(export_names, "int32 VMProtect.VirtualMachine/Utils::Random()")
|
||||
table.insert(export_names, "int32 VMProtect.VirtualMachine/Utils::CalcCRC(unsigned int32, unsigned int32)")
|
||||
table.insert(export_names, "object VMProtect.VirtualMachine/Utils::BoxPointer(void*)")
|
||||
table.insert(export_names, "void* VMProtect.VirtualMachine/Utils::UnboxPointer(object)")
|
||||
else
|
||||
table.insert(export_names, "SetupImage")
|
||||
table.insert(export_names, "FreeImage")
|
||||
table.insert(export_names, "ExportedDecryptString")
|
||||
table.insert(export_names, "ExportedDecryptString")
|
||||
table.insert(export_names, "ExportedFreeString")
|
||||
table.insert(export_names, "ExportedSetSerialNumber")
|
||||
table.insert(export_names, "ExportedGetSerialNumberState")
|
||||
table.insert(export_names, "ExportedGetSerialNumberData")
|
||||
table.insert(export_names, "ExportedGetCurrentHWID")
|
||||
table.insert(export_names, "ExportedActivateLicense")
|
||||
table.insert(export_names, "ExportedDeactivateLicense")
|
||||
table.insert(export_names, "ExportedGetOfflineActivationString")
|
||||
table.insert(export_names, "ExportedGetOfflineDeactivationString")
|
||||
table.insert(export_names, "ExportedIsValidImageCRC")
|
||||
table.insert(export_names, "ExportedIsDebuggerPresent")
|
||||
table.insert(export_names, "ExportedIsVirtualMachinePresent")
|
||||
table.insert(export_names, "ExportedDecryptBuffer")
|
||||
table.insert(export_names, "ExportedIsProtected")
|
||||
table.insert(export_names, "CalcCRC")
|
||||
|
||||
if file:file():format() == "PE" then
|
||||
table.insert(export_names, "LoaderData")
|
||||
table.insert(export_names, "ExportedLoadResource")
|
||||
table.insert(export_names, "ExportedFindResourceA")
|
||||
table.insert(export_names, "ExportedFindResourceExA")
|
||||
table.insert(export_names, "ExportedFindResourceW")
|
||||
table.insert(export_names, "ExportedFindResourceExW")
|
||||
table.insert(export_names, "ExportedLoadStringA")
|
||||
table.insert(export_names, "ExportedLoadStringW")
|
||||
table.insert(export_names, "ExportedEnumResourceNamesA")
|
||||
table.insert(export_names, "ExportedEnumResourceNamesW")
|
||||
table.insert(export_names, "ExportedEnumResourceLanguagesA")
|
||||
table.insert(export_names, "ExportedEnumResourceLanguagesW")
|
||||
table.insert(export_names, "ExportedEnumResourceTypesA")
|
||||
table.insert(export_names, "ExportedEnumResourceTypesW")
|
||||
elseif file:file():format() == "Mach-O" then
|
||||
table.insert(export_names, "_loader_data")
|
||||
table.insert(export_names, "DllMain")
|
||||
else
|
||||
table.insert(export_names, "loader_data")
|
||||
table.insert(export_names, "DllMain")
|
||||
end
|
||||
end
|
||||
|
||||
count = 0
|
||||
data = ""
|
||||
for _, line in ipairs(export_names) do
|
||||
export = file:exports():itemByName(line)
|
||||
if (export) then
|
||||
data = data .. DWordToChar(export:address() - file:imageBase())
|
||||
count = count + 1
|
||||
else
|
||||
print(line .. " not found!!!")
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
|
||||
-- process SDK
|
||||
|
||||
imports = file:imports()
|
||||
|
||||
sdk_indexes = {}
|
||||
count = 0
|
||||
data = ""
|
||||
for i = 1, imports:count() do
|
||||
import = imports:item(i)
|
||||
if (import:isSDK()) then
|
||||
table.insert(sdk_indexes, i)
|
||||
for j = 1, import:count() do
|
||||
import_function = import:item(j)
|
||||
map_function = map_functions:itemByAddress(import_function:address())
|
||||
if (map_function) then
|
||||
data = data .. ByteToChar(import_function:type())
|
||||
data = data .. DWordToChar(import_function:address() - file:imageBase())
|
||||
count = count + 1
|
||||
|
||||
references = map_function:references()
|
||||
data = data .. DWordToChar(references:count())
|
||||
for k = 1, references:count() do
|
||||
reference = references:item(k)
|
||||
data = data .. DWordToChar(reference:address() - file:imageBase())
|
||||
data = data .. DWordToChar(reference:operandAddress() - file:imageBase())
|
||||
end
|
||||
|
||||
references:clear()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
|
||||
-- process import references
|
||||
|
||||
count = 0
|
||||
data = ""
|
||||
for i = 1, imports:count() do
|
||||
import = imports:item(i)
|
||||
for j = 1, import:count() do
|
||||
import_function = import:item(j)
|
||||
map_function = map_functions:itemByAddress(import_function:address())
|
||||
if (map_function) then
|
||||
references = map_function:references()
|
||||
for k = references:count(), 1, -1 do
|
||||
reference = references:item(k)
|
||||
is_found = false
|
||||
for p = 1, functions:count() do
|
||||
if (functions:item(p):itemByAddress(reference:address(), true)) then
|
||||
is_found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if (is_found) then
|
||||
sdk_count = 0;
|
||||
for _, sdk_index in ipairs(sdk_indexes) do
|
||||
if (i > sdk_index) then
|
||||
sdk_count = sdk_count + 1
|
||||
end
|
||||
end
|
||||
data = data .. DWordToChar(i - sdk_count) .. DWordToChar(j)
|
||||
data = data .. DWordToChar(reference:address() - file:imageBase())
|
||||
data = data .. DWordToChar(reference:operandAddress() - file:imageBase())
|
||||
count = count + 1
|
||||
|
||||
references:delete(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
|
||||
-- process strings
|
||||
|
||||
count = 0
|
||||
data = ""
|
||||
for i = 1, map_functions:count() do
|
||||
map_function = map_functions:item(i)
|
||||
if (map_function:type() == ObjectType.String) then
|
||||
data = data .. DWordToChar(map_function:address() - file:imageBase())
|
||||
data = data .. DWordToChar(map_function:address() + map_function:size() - file:imageBase())
|
||||
count = count + 1
|
||||
|
||||
references = map_function:references()
|
||||
data = data .. DWordToChar(references:count())
|
||||
for k = 1, references:count() do
|
||||
reference = references:item(k)
|
||||
data = data .. DWordToChar(reference:address() - file:imageBase())
|
||||
data = data .. DWordToChar(reference:operandAddress() - file:imageBase())
|
||||
data = data .. ByteToChar(reference:tag())
|
||||
end
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
|
||||
-- process functions
|
||||
|
||||
count = 0
|
||||
data = ""
|
||||
for k = 1, functions:count() do
|
||||
func = functions:item(k)
|
||||
if (not func:needCompile()) then
|
||||
count = count + 1
|
||||
|
||||
params = function_params[tostring(func:address())]
|
||||
if (not params) then
|
||||
params = ""
|
||||
end
|
||||
|
||||
t = 0
|
||||
if (params:len() > 0) then
|
||||
if (params:sub(1, 1) == "L") then
|
||||
t = 1
|
||||
elseif (params:sub(1, 1) == "B") then
|
||||
t = 2
|
||||
elseif (params:sub(1, 1) == "R") then
|
||||
t = 3
|
||||
elseif (params:sub(1, 1) == "E") then
|
||||
t = 4
|
||||
elseif (params:sub(1, 1) == "I") then
|
||||
t = 5
|
||||
elseif (params:sub(1, 1) == "P") then
|
||||
t = 6
|
||||
end
|
||||
end
|
||||
|
||||
e = 0
|
||||
if (params:len() > 2) then
|
||||
if (params:sub(3, 3) == "N") then
|
||||
e = 1
|
||||
elseif (params:sub(3, 3) == "R") then
|
||||
e = 2
|
||||
end
|
||||
end
|
||||
|
||||
data = data .. ByteToChar(t)
|
||||
.. ByteToChar(func:compilationType()
|
||||
+ Ord(e == 1) * 0x10
|
||||
+ Ord(e == 2) * 0x20
|
||||
+ 0x80)
|
||||
.. ByteToChar(func:type())
|
||||
.. ByteToChar(file:cpuAddressSize())
|
||||
.. DWordToChar(func:address() - file:imageBase())
|
||||
|
||||
data = data .. DWordToChar(func:count())
|
||||
for i = 1, func:count() do
|
||||
command = func:item(i)
|
||||
if (file:name() == ".NET") then
|
||||
-- IL
|
||||
p = 0;
|
||||
if (command:operandValue() > 0) then
|
||||
p = 1
|
||||
end
|
||||
data = data .. ByteToChar(p
|
||||
+ Ord(command:tokenReference()) * 0x08
|
||||
+ Ord(command:size() > 255) * 0x10
|
||||
+ Ord(command:link()) * 0x20)
|
||||
.. DWordToChar(command:address() - file:imageBase())
|
||||
.. WordToChar(command:type())
|
||||
.. DWordToChar(command:options())
|
||||
.. ByteToChar(command:alignment())
|
||||
|
||||
if (command:size() > 255) then
|
||||
data = data .. WordToChar(command:size())
|
||||
else
|
||||
data = data .. ByteToChar(command:size())
|
||||
end
|
||||
|
||||
if (command:type() == ILCommandType.Comment or command:type() == ILCommandType.Data) then
|
||||
for j = 1, command:size() do
|
||||
data = data .. ByteToChar(command:dump(j))
|
||||
end
|
||||
end
|
||||
|
||||
if (p > 0) then
|
||||
data = data .. QWordToChar(command:operandValue())
|
||||
end
|
||||
else
|
||||
-- Intel
|
||||
if (command:type() == IntelCommandType.Lods or
|
||||
command:type() == IntelCommandType.Stos or
|
||||
command:type() == IntelCommandType.Scas or
|
||||
command:type() == IntelCommandType.Movs or
|
||||
command:type() == IntelCommandType.Cmps or
|
||||
command:type() == IntelCommandType.Ins or
|
||||
command:type() == IntelCommandType.Outs) then
|
||||
p = 2
|
||||
elseif (command:type() == IntelCommandType.Pusha or
|
||||
command:type() == IntelCommandType.Popa or
|
||||
command:type() == IntelCommandType.Pushf or
|
||||
command:type() == IntelCommandType.Popf) then
|
||||
p = 1
|
||||
else
|
||||
p = 0
|
||||
for j = 1, 3 do
|
||||
operand = command:operand(j)
|
||||
if (operand:type() == OperandType.None) then
|
||||
break
|
||||
end
|
||||
p = p + 1
|
||||
end
|
||||
end
|
||||
|
||||
data = data .. ByteToChar(p
|
||||
+ Ord(command:preffix() ~= 0) * 0x8
|
||||
+ Ord(command:size() > 255) * 0x10
|
||||
+ Ord(command:link()) * 0x20
|
||||
+ Ord(command:baseSegment() ~= IntelSegment.Default) * 0x40
|
||||
+ Ord(command:flags() ~= 0) * 0x80)
|
||||
.. DWordToChar(command:address() - file:imageBase())
|
||||
.. WordToChar(command:type())
|
||||
.. DWordToChar(command:options())
|
||||
.. ByteToChar(command:alignment())
|
||||
|
||||
if (command:preffix() ~= 0) then
|
||||
data = data .. WordToChar(command:preffix())
|
||||
end
|
||||
if (command:size() > 255) then
|
||||
data = data .. WordToChar(command:size())
|
||||
else
|
||||
data = data .. ByteToChar(command:size())
|
||||
end
|
||||
if (command:baseSegment() ~= IntelSegment.Default) then
|
||||
data = data .. ByteToChar(command:baseSegment())
|
||||
end
|
||||
if (command:flags() ~= 0) then
|
||||
data = data .. WordToChar(command:flags())
|
||||
end
|
||||
|
||||
if (command:type() == IntelCommandType.Db) then
|
||||
for j = 1, command:size() do
|
||||
data = data .. ByteToChar(command:dump(j))
|
||||
end
|
||||
else
|
||||
r = 0
|
||||
if (command:type() == IntelCommandType.Jmp or
|
||||
command:type() == IntelCommandType.Call or
|
||||
command:type() == IntelCommandType.Loop or
|
||||
command:type() == IntelCommandType.Loope or
|
||||
command:type() == IntelCommandType.Loopne or
|
||||
command:type() == IntelCommandType.Jxx or
|
||||
command:type() == IntelCommandType.Jcxz) then
|
||||
operand = command:operand(1)
|
||||
if (operand:type() == OperandType.Value) then
|
||||
r = 1
|
||||
end
|
||||
end
|
||||
|
||||
for j = 1, p do
|
||||
operand = command:operand(j)
|
||||
address_size = operand:addressSize()
|
||||
if bit32.btest(operand:type(), OperandType.Memory) then
|
||||
address_size = operand:addressSize()
|
||||
else
|
||||
address_size = 0
|
||||
end
|
||||
|
||||
if operand:fixup() then
|
||||
fixup = 1
|
||||
elseif operand:isLargeValue() then
|
||||
fixup = 2
|
||||
else
|
||||
fixup = 0
|
||||
end
|
||||
|
||||
data = data .. ByteToChar(operand:size())
|
||||
.. WordToChar(operand:type()
|
||||
+ Ord(j == r) * 0x1000
|
||||
+ Ord(address_size ~= file:cpuAddressSize()) * 0x2000
|
||||
+ Ord(operand:scale() > 0) * 0x4000
|
||||
+ Ord(fixup > 0) * 0x8000)
|
||||
|
||||
if (bit32.btest(operand:type(), OperandType.Registr
|
||||
+ OperandType.SegmentRegistr
|
||||
+ OperandType.ControlRegistr
|
||||
+ OperandType.DebugRegistr
|
||||
+ OperandType.FPURegistr
|
||||
+ OperandType.HiPartRegistr
|
||||
+ OperandType.MMXRegistr
|
||||
+ OperandType.XMMRegistr)) then
|
||||
data = data .. ByteToChar(operand:registr())
|
||||
end
|
||||
|
||||
if (bit32.btest(operand:type(), OperandType.BaseRegistr)) then
|
||||
data = data .. ByteToChar(operand:baseRegistr())
|
||||
end
|
||||
if (bit32.btest(operand:type(), OperandType.Value)) then
|
||||
data = data .. ByteToChar(operand:valueSize())
|
||||
if (j == r or fixup > 0) then
|
||||
data = data .. DWordToChar(operand:value() - file:imageBase())
|
||||
else
|
||||
value_size = operand:valueSize()
|
||||
if (value_size == OperandSize.Byte) then
|
||||
data = data .. ByteToChar(operand:value())
|
||||
elseif (value_size == OperandSize.Word) then
|
||||
data = data .. WordToChar(operand:value())
|
||||
elseif (value_size == OperandSize.DWord) then
|
||||
data = data .. DWordToChar(operand:value())
|
||||
elseif (value_size == OperandSize.QWord) then
|
||||
data = data .. QWordToChar(operand:value())
|
||||
end
|
||||
end
|
||||
if (fixup > 0) then
|
||||
data = data .. ByteToChar(fixup)
|
||||
end
|
||||
end
|
||||
if (bit32.btest(operand:type(), OperandType.Memory)) then
|
||||
if (operand:scale() ~= 0) then
|
||||
data = data .. ByteToChar(operand:scale())
|
||||
end
|
||||
if (operand:addressSize() ~= file:cpuAddressSize()) then
|
||||
data = data .. ByteToChar(operand:addressSize())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
data = data .. DWordToChar(func:info():count())
|
||||
for i = 1, func:info():count() do
|
||||
info = func:info():item(i)
|
||||
if (info:entry()) then
|
||||
entry_index = func:indexOf(info:entry())
|
||||
else
|
||||
entry_index = 0
|
||||
end
|
||||
|
||||
if (info:dataEntry()) then
|
||||
data_entry_index = func:indexOf(info:dataEntry())
|
||||
else
|
||||
data_entry_index = 0
|
||||
end
|
||||
|
||||
data = data .. DWordToChar(info:beginAddress() - file:imageBase())
|
||||
.. DWordToChar(info:endAddress() - file:imageBase())
|
||||
.. ByteToChar(info:baseType())
|
||||
if (info:baseType() == 0) then
|
||||
data = data .. DWordToChar(info:baseValue())
|
||||
end
|
||||
data = data .. DWordToChar(info:prologSize())
|
||||
.. ByteToChar(info:frameRegistr())
|
||||
.. DWordToChar(entry_index)
|
||||
.. DWordToChar(data_entry_index)
|
||||
.. DWordToChar(info:unwindOpcodes():count())
|
||||
for j = 1, info:unwindOpcodes():count() do
|
||||
data = data .. DWordToChar(func:indexOf(info:unwindOpcodes():item(j)))
|
||||
end
|
||||
end
|
||||
|
||||
data = data .. DWordToChar(func:ranges():count())
|
||||
for i = 1, func:ranges():count() do
|
||||
range = func:ranges():item(i)
|
||||
if (range:beginEntry()) then
|
||||
begin_index = func:indexOf(range:beginEntry())
|
||||
else
|
||||
begin_index = 0
|
||||
end
|
||||
if (range:endEntry()) then
|
||||
end_index = func:indexOf(range:endEntry())
|
||||
else
|
||||
end_index = 0
|
||||
end
|
||||
if (range:sizeEntry()) then
|
||||
size_index = func:indexOf(range:sizeEntry())
|
||||
else
|
||||
size_index = 0
|
||||
end
|
||||
|
||||
data = data .. DWordToChar(range:beginAddress() - file:imageBase())
|
||||
.. DWordToChar(range:endAddress() - file:imageBase())
|
||||
.. DWordToChar(begin_index)
|
||||
.. DWordToChar(end_index)
|
||||
.. DWordToChar(size_index)
|
||||
end
|
||||
|
||||
data = data .. DWordToChar(func:links():count())
|
||||
for i = 1, func:links():count() do
|
||||
link = func:links():item(i)
|
||||
data = data .. DWordToChar(func:indexOf(link:from()))
|
||||
.. ByteToChar(link:type())
|
||||
.. ByteToChar(link:operand())
|
||||
.. ByteToChar(Ord(link:toAddress() > 0)
|
||||
+ Ord(link:subValue() > 0) * 0x2
|
||||
+ Ord(link:parent()) * 0x4
|
||||
+ Ord(link:baseInfo()) * 0x8)
|
||||
|
||||
if (link:toAddress() > 0) then
|
||||
data = data .. DWordToChar(link:toAddress() - file:imageBase())
|
||||
end
|
||||
if (link:subValue() > 0) then
|
||||
data = data .. DWordToChar(link:subValue() - file:imageBase())
|
||||
end
|
||||
if (link:parent()) then
|
||||
data = data .. DWordToChar(func:indexOf(link:parent()))
|
||||
end
|
||||
if (link:baseInfo()) then
|
||||
data = data .. DWordToChar(func:info():indexOf(link:baseInfo()))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
|
||||
if (file:file():format() == "PE") then
|
||||
-- process CFG addresses
|
||||
|
||||
count = 0
|
||||
data = ""
|
||||
if (file:name() ~= ".NET") then
|
||||
cfg_names = {}
|
||||
table.insert(cfg_names, "_freefls")
|
||||
table.insert(cfg_names, "__freefls@4")
|
||||
for _, line in ipairs(cfg_names) do
|
||||
map_function = map_functions:itemByName(line)
|
||||
if (map_function) then
|
||||
data = data .. DWordToChar(map_function:address() - file:imageBase())
|
||||
count = count + 1
|
||||
else
|
||||
print(line .. " not found!!!")
|
||||
end
|
||||
end
|
||||
end
|
||||
code_data = code_data .. DWordToChar(count) .. data
|
||||
end]]>
|
||||
</Script>
|
||||
<DLLBox />
|
||||
<LicenseManager ProductCode="" />
|
||||
</Document>
|
||||
+8885
File diff suppressed because it is too large
Load Diff
+1734
File diff suppressed because it is too large
Load Diff
+491
@@ -0,0 +1,491 @@
|
||||
/**
|
||||
* Stream implementation.
|
||||
*/
|
||||
|
||||
#include "../runtime/crypto.h"
|
||||
#include "objects.h"
|
||||
#include "osutils.h"
|
||||
#include "streams.h"
|
||||
|
||||
/**
|
||||
* AbstractStream
|
||||
*/
|
||||
|
||||
size_t AbstractStream::CopyFrom(AbstractStream &source, size_t count)
|
||||
{
|
||||
size_t copied_size, n, nc, total;
|
||||
#define BUF_SIZE 4096 /* Let's use page size */
|
||||
uint8_t buf[BUF_SIZE];
|
||||
|
||||
total = 0; /* Total copied */
|
||||
for (n = 0; n < count; n += BUF_SIZE) {
|
||||
nc = BUF_SIZE; /* Number of bytes to copy */
|
||||
if (count - n < BUF_SIZE)
|
||||
nc = count - n;
|
||||
copied_size = source.Read(buf, nc);
|
||||
if (copied_size)
|
||||
Write(buf, copied_size);
|
||||
|
||||
total += copied_size;
|
||||
if (nc != copied_size)
|
||||
break;
|
||||
}
|
||||
Flush();
|
||||
return total;
|
||||
}
|
||||
|
||||
uint64_t AbstractStream::Tell()
|
||||
{
|
||||
return Seek(0, soCurrent);
|
||||
}
|
||||
|
||||
uint64_t AbstractStream::Size()
|
||||
{
|
||||
uint64_t pos = Tell();
|
||||
uint64_t size = Seek(0, soEnd);
|
||||
/* Restore previous position */
|
||||
Seek(pos, soBeginning);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*static __inline bool IsCrLf(char c)
|
||||
{
|
||||
return c == '\r' || c == '\n';
|
||||
}*/
|
||||
|
||||
/**
|
||||
* MemoryStream
|
||||
*/
|
||||
|
||||
MemoryStream::MemoryStream(size_t /*buf_size_increment*/)
|
||||
: pos_(0)/*, buf_size_inc_(buf_size_increment)*/
|
||||
{
|
||||
}
|
||||
|
||||
size_t MemoryStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
if (pos_ + size > buf_.size())
|
||||
size = buf_.size() - pos_;
|
||||
if (size) {
|
||||
memcpy(buffer, &buf_[pos_], size);
|
||||
pos_ += size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
uint64_t MemoryStream::Resize(uint64_t new_size)
|
||||
{
|
||||
buf_.resize(static_cast<size_t>(new_size));
|
||||
pos_ = buf_.size();
|
||||
return new_size;
|
||||
}
|
||||
|
||||
size_t MemoryStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
if (size) {
|
||||
if (pos_ + size > buf_.size())
|
||||
buf_.resize(pos_ + size);
|
||||
|
||||
memcpy(&buf_[pos_], buffer, size);
|
||||
pos_ += size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
uint64_t MemoryStream::Seek(int64_t offset, SeekOrigin origin)
|
||||
{
|
||||
intptr_t req_pos;
|
||||
|
||||
req_pos = static_cast<intptr_t>(offset);
|
||||
switch (origin) {
|
||||
case soBeginning:
|
||||
break;
|
||||
case soCurrent:
|
||||
req_pos += pos_;
|
||||
break;
|
||||
case soEnd:
|
||||
req_pos += buf_.size();
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
pos_ = req_pos;
|
||||
return pos_;
|
||||
}
|
||||
|
||||
/**
|
||||
* MemoryStreamEnc
|
||||
*/
|
||||
|
||||
MemoryStreamEnc::MemoryStreamEnc(const void *buffer, size_t size, uint32_t key)
|
||||
: MemoryStream(), key_(key)
|
||||
{
|
||||
MemoryStream::Write(buffer, size);
|
||||
}
|
||||
|
||||
size_t MemoryStreamEnc::Read(void *buffer, size_t size)
|
||||
{
|
||||
uint64_t pos = Seek(0, soCurrent);
|
||||
size_t res = MemoryStream::Read(buffer, size);
|
||||
for (size_t i = 0; i < res; i++) {
|
||||
int p = static_cast<int>(pos + i);
|
||||
reinterpret_cast<uint8_t *>(buffer)[i] ^= static_cast<uint8_t>(_rotl32(key_, p) + p);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
size_t MemoryStreamEnc::Write(const void *buffer, size_t size)
|
||||
{
|
||||
size_t res;
|
||||
if (size) {
|
||||
uint64_t pos = Seek(0, soCurrent);
|
||||
uint8_t *enc_buffer = new uint8_t[size];
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
int p = static_cast<int>(pos + i);
|
||||
enc_buffer[i] = reinterpret_cast<const uint8_t *>(buffer)[i] ^ static_cast<uint8_t>(_rotl32(key_, p) + p);
|
||||
}
|
||||
res = MemoryStream::Write(enc_buffer, size);
|
||||
delete [] enc_buffer;
|
||||
} else {
|
||||
res = MemoryStream::Write(buffer, size);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* ModuleStream
|
||||
*/
|
||||
|
||||
ModuleStream::ModuleStream()
|
||||
: AbstractStream(), pos_(0), size_(0), base_address_(0), process_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ModuleStream::~ModuleStream()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
bool ModuleStream::Open(uint32_t process_id, HMODULE module)
|
||||
{
|
||||
Close();
|
||||
|
||||
process_ = os::ProcessOpen(process_id);
|
||||
if (!process_)
|
||||
return false;
|
||||
|
||||
MODULE_INFO module_info;
|
||||
if (!os::GetModuleInformation(process_, module, &module_info, sizeof(module_info)))
|
||||
return false;
|
||||
|
||||
base_address_ = module_info.address;
|
||||
size_ = module_info.size;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModuleStream::Close()
|
||||
{
|
||||
pos_ = 0;
|
||||
size_ = 0;
|
||||
base_address_ = NULL;
|
||||
if (process_) {
|
||||
os::ProcessClose(process_);
|
||||
process_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t ModuleStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
size_t res = os::ProcessRead(process_, reinterpret_cast<uint8_t*>(base_address_) + pos_, buffer, size);
|
||||
if (res != (size_t)-1)
|
||||
pos_ += res;
|
||||
return res;
|
||||
}
|
||||
|
||||
size_t ModuleStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
size_t res = os::ProcessWrite(process_, reinterpret_cast<uint8_t*>(base_address_) + pos_, buffer, size);
|
||||
if (res != (size_t)-1)
|
||||
pos_ += res;
|
||||
return res;
|
||||
}
|
||||
|
||||
uint64_t ModuleStream::Seek(int64_t offset, SeekOrigin origin)
|
||||
{
|
||||
intptr_t req_pos;
|
||||
|
||||
req_pos = static_cast<intptr_t>(offset);
|
||||
switch (origin) {
|
||||
case soBeginning:
|
||||
break;
|
||||
case soCurrent:
|
||||
req_pos += pos_;
|
||||
break;
|
||||
case soEnd:
|
||||
req_pos += size_;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
pos_ = req_pos;
|
||||
return pos_;
|
||||
}
|
||||
|
||||
/**
|
||||
* FileStream
|
||||
*/
|
||||
|
||||
FileStream::FileStream(size_t CACHE_ALLOC_SIZE /*= 0x10000*/)
|
||||
: h_(INVALID_HANDLE_VALUE), cache_mode_(cmNone), CACHE_ALLOC_SIZE_(CACHE_ALLOC_SIZE), cache_pos_(0), cache_size_(0), cache_offset_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FileStream::~FileStream()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
bool FileStream::Open(const char *filename, int mode)
|
||||
{
|
||||
Close();
|
||||
|
||||
h_ = os::FileCreate(filename, mode);
|
||||
return (h_ != INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
void FileStream::Close()
|
||||
{
|
||||
FlushCache();
|
||||
|
||||
if (h_ != INVALID_HANDLE_VALUE) {
|
||||
os::FileClose(h_);
|
||||
h_ = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t * FileStream::Cache()
|
||||
{
|
||||
uint8_t *ret = cache_.get();
|
||||
if (ret == NULL)
|
||||
{
|
||||
ret = new uint8_t[CACHE_ALLOC_SIZE_];
|
||||
cache_.reset(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FileStream::FlushCache(bool need_seek)
|
||||
{
|
||||
switch (cache_mode_) {
|
||||
case cmRead:
|
||||
if (need_seek && os::FileSeek(h_, cache_offset_ + cache_pos_, soBeginning) == (uint64_t)-1)
|
||||
throw std::runtime_error("Runtime Error at Flush");
|
||||
break;
|
||||
case cmWrite:
|
||||
if (cache_pos_ && os::FileWrite(h_, Cache(), cache_pos_) != cache_pos_)
|
||||
throw std::runtime_error("Runtime Error at Flush");
|
||||
break;
|
||||
}
|
||||
cache_mode_ = cmNone;
|
||||
cache_size_ = 0;
|
||||
cache_pos_ = 0;
|
||||
cache_offset_ = 0;
|
||||
}
|
||||
|
||||
size_t FileStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
size_t add_size = 0;
|
||||
if (cache_mode_ == cmRead) {
|
||||
size_t cache_size = cache_size_ - cache_pos_;
|
||||
if (size <= cache_size) {
|
||||
memcpy(buffer, Cache() + cache_pos_, size);
|
||||
cache_pos_ += size;
|
||||
return size;
|
||||
}
|
||||
if (cache_size) {
|
||||
memcpy(buffer, Cache() + cache_pos_, cache_size);
|
||||
cache_pos_ += cache_size;
|
||||
size -= cache_size;
|
||||
add_size = cache_size;
|
||||
buffer = static_cast<uint8_t*>(buffer) + cache_size;
|
||||
}
|
||||
}
|
||||
FlushCache();
|
||||
|
||||
if (size < CACHE_ALLOC_SIZE_) {
|
||||
cache_offset_ = os::FileSeek(h_, 0, soCurrent);
|
||||
size_t cache_size = os::FileRead(h_, Cache(), CACHE_ALLOC_SIZE_);
|
||||
// check error
|
||||
if (cache_size == (size_t)-1)
|
||||
return cache_size;
|
||||
if (size > cache_size)
|
||||
size = cache_size;
|
||||
cache_mode_ = cmRead;
|
||||
cache_size_ = cache_size;
|
||||
memcpy(buffer, Cache(), size);
|
||||
cache_pos_ = size;
|
||||
return size + add_size;
|
||||
}
|
||||
|
||||
size_t res = os::FileRead(h_, buffer, size);
|
||||
// check error
|
||||
if (res == (size_t)-1)
|
||||
return res;
|
||||
return res + add_size;
|
||||
}
|
||||
|
||||
size_t FileStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
size_t add_size = 0;
|
||||
if (cache_mode_ == cmWrite) {
|
||||
size_t cache_size = cache_size_ - cache_pos_;
|
||||
if (size <= cache_size) {
|
||||
memcpy(Cache() + cache_pos_, buffer, size);
|
||||
cache_pos_ += size;
|
||||
return size;
|
||||
}
|
||||
if (cache_size) {
|
||||
memcpy(Cache() + cache_pos_, buffer, cache_size);
|
||||
cache_pos_ += cache_size;
|
||||
size -= cache_size;
|
||||
add_size = cache_size;
|
||||
buffer = static_cast<const uint8_t*>(buffer) + cache_size;
|
||||
}
|
||||
}
|
||||
FlushCache(true);
|
||||
|
||||
if (size < CACHE_ALLOC_SIZE_) {
|
||||
cache_offset_ = os::FileSeek(h_, 0, soCurrent);
|
||||
cache_mode_ = cmWrite;
|
||||
cache_size_ = CACHE_ALLOC_SIZE_;
|
||||
memcpy(Cache(), buffer, size);
|
||||
cache_pos_ = size;
|
||||
return size + add_size;
|
||||
}
|
||||
|
||||
size_t res = os::FileWrite(h_, buffer, size);
|
||||
// check error
|
||||
if (res == (size_t)-1)
|
||||
return res;
|
||||
return res + add_size;
|
||||
}
|
||||
|
||||
uint64_t FileStream::Seek(int64_t offset, SeekOrigin origin)
|
||||
{
|
||||
if (cache_mode_ != cmNone) {
|
||||
switch (origin) {
|
||||
case soBeginning:
|
||||
{
|
||||
uint64_t pos = static_cast<uint64_t>(offset);
|
||||
if (pos == cache_offset_ + cache_pos_)
|
||||
return cache_offset_ + cache_pos_;
|
||||
if (cache_mode_ == cmRead && pos >= cache_offset_ && pos <= cache_offset_ + cache_size_) {
|
||||
cache_pos_ = static_cast<size_t>(pos - cache_offset_);
|
||||
return cache_offset_ + cache_pos_;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case soCurrent:
|
||||
if (cache_mode_ == cmRead) {
|
||||
if (offset + (int64_t)cache_pos_ >= 0 && offset + cache_pos_ <= cache_size_) {
|
||||
cache_pos_ = static_cast<size_t>(offset + cache_pos_);
|
||||
return cache_offset_ + cache_pos_;
|
||||
}
|
||||
offset -= cache_size_ - cache_pos_;
|
||||
}
|
||||
break;
|
||||
}
|
||||
FlushCache();
|
||||
}
|
||||
|
||||
return os::FileSeek(h_, offset, origin);
|
||||
}
|
||||
|
||||
uint64_t FileStream::Resize(uint64_t new_size)
|
||||
{
|
||||
uint64_t res = Seek(new_size, soBeginning);
|
||||
FlushCache(true);
|
||||
os::FileSetEnd(h_);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool FileStream::ReadLine(std::string &out_line)
|
||||
{
|
||||
bool res = true;
|
||||
out_line.clear();
|
||||
for (;;) {
|
||||
char c;
|
||||
if (Read(&c, sizeof(c)) == 0) {
|
||||
res = !out_line.empty();
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '\n') {
|
||||
break;
|
||||
} else if (c == '\r') {
|
||||
if (Read(&c, sizeof(c)) && c != '\n')
|
||||
Seek(-1, soCurrent);
|
||||
break;
|
||||
} else {
|
||||
out_line.push_back(c);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string FileStream::ReadAll()
|
||||
{
|
||||
std::string res;
|
||||
size_t sz = static_cast<size_t>(Size());
|
||||
if (sz) {
|
||||
res.resize(sz);
|
||||
Read(&res[0], sz);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buffer
|
||||
*/
|
||||
|
||||
Buffer::Buffer(const uint8_t *memory)
|
||||
: memory_(memory), position_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint8_t Buffer::ReadByte()
|
||||
{
|
||||
uint8_t res;
|
||||
ReadBuff(&res, sizeof(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
uint16_t Buffer::ReadWord()
|
||||
{
|
||||
uint16_t res;
|
||||
ReadBuff(&res, sizeof(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
uint32_t Buffer::ReadDWord()
|
||||
{
|
||||
uint32_t res;
|
||||
ReadBuff(&res, sizeof(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
uint64_t Buffer::ReadQWord()
|
||||
{
|
||||
uint64_t res;
|
||||
ReadBuff(&res, sizeof(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
void Buffer::ReadBuff(void *buff, size_t size)
|
||||
{
|
||||
memcpy(buff, &memory_[position_], size);
|
||||
position_ += size;
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Stream implementation.
|
||||
*/
|
||||
|
||||
#ifndef STREAMS_H
|
||||
#define STREAMS_H
|
||||
|
||||
class AbstractStream
|
||||
{
|
||||
public:
|
||||
virtual ~AbstractStream() {}
|
||||
virtual size_t Read(void *buffer, size_t size) = 0;
|
||||
virtual size_t Write(const void *buffer, size_t size) = 0;
|
||||
virtual uint64_t Seek(int64_t offset, SeekOrigin origin) = 0;
|
||||
virtual size_t CopyFrom(AbstractStream &source, size_t count);
|
||||
uint64_t Tell();
|
||||
uint64_t Size();
|
||||
virtual uint64_t Resize(uint64_t new_size) = 0;
|
||||
virtual void Flush() {}
|
||||
};
|
||||
|
||||
class FileStream : public AbstractStream
|
||||
{
|
||||
public:
|
||||
explicit FileStream(size_t CACHE_ALLOC_SIZE = 0x10000);
|
||||
virtual ~FileStream();
|
||||
virtual bool Open(const char *filename, int mode);
|
||||
virtual void Close();
|
||||
virtual size_t Read(void *buffer, size_t size);
|
||||
virtual size_t Write(const void *buffer, size_t size);
|
||||
virtual uint64_t Seek(int64_t offset, SeekOrigin origin);
|
||||
virtual uint64_t Resize(uint64_t new_size);
|
||||
virtual void Flush() { FlushCache(); }
|
||||
bool ReadLine(std::string &line);
|
||||
std::string ReadAll();
|
||||
protected:
|
||||
uint8_t *Cache();
|
||||
void FlushCache(bool need_seek = false);
|
||||
|
||||
HANDLE h_;
|
||||
enum CacheMode {
|
||||
cmNone,
|
||||
cmRead,
|
||||
cmWrite
|
||||
};
|
||||
CacheMode cache_mode_;
|
||||
const size_t CACHE_ALLOC_SIZE_;
|
||||
std::auto_ptr<uint8_t> cache_;
|
||||
size_t cache_pos_;
|
||||
size_t cache_size_;
|
||||
uint64_t cache_offset_;
|
||||
};
|
||||
|
||||
class MemoryStream : public AbstractStream
|
||||
{
|
||||
public:
|
||||
explicit MemoryStream(size_t buf_size_increment = 1024);
|
||||
virtual size_t Read(void *buffer, size_t size);
|
||||
virtual size_t Write(const void *buffer, size_t size);
|
||||
virtual uint64_t Seek(int64_t offset, SeekOrigin origin);
|
||||
virtual uint64_t Resize(uint64_t new_size);
|
||||
std::vector<uint8_t> data() const { return buf_; }
|
||||
private:
|
||||
std::vector <uint8_t> buf_;
|
||||
size_t pos_;
|
||||
};
|
||||
|
||||
class MemoryStreamEnc : public MemoryStream
|
||||
{
|
||||
public:
|
||||
explicit MemoryStreamEnc(const void *buffer, size_t size, uint32_t key);
|
||||
virtual size_t Read(void *buffer, size_t size);
|
||||
virtual size_t Write(const void *buffer, size_t size);
|
||||
private:
|
||||
uint32_t key_;
|
||||
};
|
||||
|
||||
class ModuleStream : public AbstractStream
|
||||
{
|
||||
public:
|
||||
ModuleStream();
|
||||
~ModuleStream();
|
||||
bool Open(uint32_t process_id, HMODULE module);
|
||||
void Close();
|
||||
virtual size_t Read(void *buffer, size_t size);
|
||||
virtual size_t Write(const void *buffer, size_t size);
|
||||
virtual uint64_t Seek(int64_t offset, SeekOrigin origin);
|
||||
virtual uint64_t Resize(uint64_t /*new_size*/) { return size_; }
|
||||
private:
|
||||
size_t pos_;
|
||||
size_t size_;
|
||||
void *base_address_;
|
||||
HANDLE process_;
|
||||
};
|
||||
|
||||
class Buffer
|
||||
{
|
||||
public:
|
||||
Buffer(const uint8_t *memory);
|
||||
uint8_t ReadByte();
|
||||
uint16_t ReadWord();
|
||||
uint32_t ReadDWord();
|
||||
uint64_t ReadQWord();
|
||||
private:
|
||||
void ReadBuff(void *buff, size_t size);
|
||||
const uint8_t *memory_;
|
||||
size_t position_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,117 @@
|
||||
@ECHO OFF
|
||||
echo version.bat: generating build number...
|
||||
|
||||
SET version_h=%1core\version.h
|
||||
SET info_plist=%1app\vmprotect_gui.app\Contents\Info.plist
|
||||
|
||||
SET major=1
|
||||
SET minor=0
|
||||
SET patch=0
|
||||
SET build=0
|
||||
|
||||
IF "%bamboo_VMP_MAJOR%" neq "" SET major=%bamboo_VMP_MAJOR%
|
||||
IF "%bamboo_VMP_MINOR%" neq "" SET minor=%bamboo_VMP_MINOR%
|
||||
IF "%bamboo_VMP_SUBMINOR%" neq "" SET patch=%bamboo_VMP_SUBMINOR%
|
||||
IF "%bamboo_buildNumber%" neq "" SET build=%bamboo_buildNumber%
|
||||
|
||||
SET has_major=
|
||||
SET has_minor=
|
||||
SET has_patch=
|
||||
SET has_build=
|
||||
|
||||
if EXIST %version_h% (
|
||||
for /f "tokens=1-3 delims= " %%A in (%version_h%) do (
|
||||
IF "%%B"=="VER_MAJOR" (
|
||||
SET has_major=%%C
|
||||
)
|
||||
IF "%%B"=="VER_MINOR" (
|
||||
SET has_minor=%%C
|
||||
)
|
||||
IF "%%B"=="VER_PATCH" (
|
||||
SET has_patch=%%C
|
||||
)
|
||||
IF "%%B"=="VER_BUILD" (
|
||||
SET has_build=%%C
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%major%.%minor%.%patch%.%build%" neq "%has_major%.%has_minor%.%has_patch%.%has_build%" (
|
||||
ECHO version.bat: build number incremented to %major%.%minor%.%patch%.%build% at %version_h%
|
||||
ECHO #define VER_MAJOR %major% > %version_h%
|
||||
ECHO #define VER_MINOR %minor% >> %version_h%
|
||||
ECHO #define VER_PATCH %patch% >> %version_h%
|
||||
ECHO #define VER_BUILD %build% >> %version_h%
|
||||
ECHO #define VER_FILE "%major%.%minor%.%patch%.%build%" >> %version_h%
|
||||
ECHO #define VER_PRODUCT "%major%.%minor%.%patch%" >> %version_h%
|
||||
) else (
|
||||
ECHO version.bat: build number at %version_h% = %major%.%minor%.%patch%.%build% is up to date
|
||||
)
|
||||
|
||||
ECHO ^<?xml version="1.0" encoding="UTF-8"?^> > %info_plist%
|
||||
ECHO ^<^!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"^> >> %info_plist%
|
||||
ECHO ^<plist version="1.0"^> >> %info_plist%
|
||||
ECHO ^<dict^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleDevelopmentRegion^</key^> >> %info_plist%
|
||||
ECHO ^<string^>en^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleExecutable^</key^> >> %info_plist%
|
||||
ECHO ^<string^>vmprotect_gui^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleIconFile^</key^> >> %info_plist%
|
||||
ECHO ^<string^>logo.icns^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleIdentifier^</key^> >> %info_plist%
|
||||
ECHO ^<string^>com.vmpsoft.vmprotect^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleInfoDictionaryVersion^</key^> >> %info_plist%
|
||||
ECHO ^<string^>6.0^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleName^</key^> >> %info_plist%
|
||||
ECHO ^<string^>VMProtect^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundlePackageType^</key^> >> %info_plist%
|
||||
ECHO ^<string^>APPL^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleShortVersionString^</key^> >> %info_plist%
|
||||
ECHO ^<string^>%major%.%minor%.%patch%^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleVersion^</key^> >> %info_plist%
|
||||
ECHO ^<string^>%build%^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleSignature^</key^> >> %info_plist%
|
||||
ECHO ^<string^>vmpg^</string^> >> %info_plist%
|
||||
ECHO ^<key^>LSMinimumSystemVersion^</key^> >> %info_plist%
|
||||
ECHO ^<string^>10.7.0^</string^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleDocumentTypes^</key^> >> %info_plist%
|
||||
ECHO ^<array^> >> %info_plist%
|
||||
ECHO ^<dict^> >> %info_plist%
|
||||
ECHO ^<key^>LSItemContentTypes^</key^> >> %info_plist%
|
||||
ECHO ^<array^> >> %info_plist%
|
||||
ECHO ^<string^>public.executable^</string^> >> %info_plist%
|
||||
ECHO ^<string^>com.microsoft.windows-executable^</string^> >> %info_plist%
|
||||
ECHO ^<string^>com.microsoft.windows-dynamic-link-library^</string^> >> %info_plist%
|
||||
ECHO ^</array^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleTypeRole^</key^> >> %info_plist%
|
||||
ECHO ^<string^>Editor^</string^> >> %info_plist%
|
||||
ECHO ^</dict^> >> %info_plist%
|
||||
ECHO ^<dict^> >> %info_plist%
|
||||
ECHO ^<key^>LSItemContentTypes^</key^> >> %info_plist%
|
||||
ECHO ^<array^> >> %info_plist%
|
||||
ECHO ^<string^>com.vmpsoft.vmprotect.vmp^</string^> >> %info_plist%
|
||||
ECHO ^</array^> >> %info_plist%
|
||||
ECHO ^<key^>CFBundleTypeRole^</key^> >> %info_plist%
|
||||
ECHO ^<string^>Editor^</string^> >> %info_plist%
|
||||
ECHO ^<key^>LSHandlerRank^</key^> >> %info_plist%
|
||||
ECHO ^<string^>Owner^</string^> >> %info_plist%
|
||||
ECHO ^</dict^> >> %info_plist%
|
||||
ECHO ^</array^> >> %info_plist%
|
||||
ECHO ^<key^>UTExportedTypeDeclarations^</key^> >> %info_plist%
|
||||
ECHO ^<array^> >> %info_plist%
|
||||
ECHO ^<dict^> >> %info_plist%
|
||||
ECHO ^<key^>UTTypeConformsTo^</key^> >> %info_plist%
|
||||
ECHO ^<array^> >> %info_plist%
|
||||
ECHO ^<string^>public.xml^</string^> >> %info_plist%
|
||||
ECHO ^</array^> >> %info_plist%
|
||||
ECHO ^<key^>UTTypeIdentifier^</key^> >> %info_plist%
|
||||
ECHO ^<string^>com.vmpsoft.vmprotect.vmp^</string^> >> %info_plist%
|
||||
ECHO ^<key^>UTTypeTagSpecification^</key^> >> %info_plist%
|
||||
ECHO ^<dict^> >> %info_plist%
|
||||
ECHO ^<key^>public.filename-extension^</key^> >> %info_plist%
|
||||
ECHO ^<string^>vmp^</string^> >> %info_plist%
|
||||
ECHO ^</dict^> >> %info_plist%
|
||||
ECHO ^</dict^> >> %info_plist%
|
||||
ECHO ^</array^> >> %info_plist%
|
||||
ECHO ^</dict^> >> %info_plist%
|
||||
ECHO ^</plist^> >> %info_plist%
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Binary file not shown.
@@ -0,0 +1,296 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Document>
|
||||
<Protection InputFileName="../bin/64/Ultimate/VMProtectCon.exe" Options="333640" CompressionMode="1" VMCodeSectionName=".UPX" VMExecutorCount="10">
|
||||
<Messages />
|
||||
<Folders />
|
||||
<Procedures />
|
||||
<Objects />
|
||||
</Protection>
|
||||
<DLLBox />
|
||||
<LicenseManager ProductCode="KUEklgWvrok=" Algorithm="RSA" Bits="3072" PublicExp="AAEAAQ==" PrivateExp="CXHXWx/Z9JqetQWwFpvmD72wrDiqQOXMQs18fhAMjWCfJ/f2r3p2io+iB3gqIuu3LGH3WJ8PQuIzvDMnbwAx+8BbAyYhWhGEbxDdifndjQ2KlDV2Hu8NQgCbc5Wjok0rKwQ+Bxeb2i1+Gu3FsnhRNv9RhSyiwcnH/4Q3+ySE3AFAcAUwuQABePjDKCYOfIyx7RKz5h0sG+v10nkPuuCGPSnh+AXDTBIJFH+yNIjkrfweC9A3dv7URyRJumAMgm/SnDU76rTkFw9vZpupQeMtMtIsZIkeFSngip9KImD5zzbb2vKD63Cg9W/Yvqgvro/d+cR5n6P0t4DzfanNIFRGpFrX8/Q5VjuezDKw/4YbsFYwOhzJPRxglmCEjh8cpfxJ11cUXa/hNBV4c4Dp29D0F+w01OlBnFb1Ck9VXur2qJCsqcWtjsnt/VITsxa1jzr+3C2+uvaI4JSd7yLEnTqSaSsRfWuhDXgjY/YWhmyvMzeQeXBGOXKt2j2lY2Fm0WJx" Modulus="pwUqwaM8IOukyx06Lvi5YNQ70JE7pwg7K+pmM/vCe1CUseHKFM1v1m11geDjVsAt38AnaiFs3JhtTs80ySCIxOSyvMw6Cd52k6N6dn7LAx1mxQLJLhYeMMJYbplMHnMLwYN0+IO58OVbEqRyaJV2ExolnK2EYZL7QRXujGY7/sOoOMF3p6GsWJK6kkBJICIoL9hHWBQMO6/9rmls/+EhaWuP80Vx0+H2OlrQ58K+TJeyE393cvb4QufiEPpCNaB50Klee9QUnsjSW/bTnmGn4Bi5+cowRbawUY73Q5I58fMAXiH9ueDPuNMR9YKDgW9GxunLmYkbuwqIp/v7kw3cfMBM0ihhB0B8UhjyAMAGLzJWX3H/H6Zrz41g9PbPjTAxfsTaCrxoqjaTaO4zk9YsI//VX9Fhivcy913SevBpNandziGfYH/oHW2xDy9AfwkE1wuIBlLj7c/k8U1YmmRAmkoCzlmB7EU4ClNltboh1uARUQ6wW30upppnuYhGkTy7" BlackList="PNKH5ffOXrnkvXz6B4rU6k+6BZtNx4k5h9oT7JLe9cojK14yMultLErA+3pwRaQHLQKP+3tYSbi+oJJ7GxWN2S+VxTFvmIJZcfeq/yuzsUQawEzyUHM//VU5JfgUw1egVmsx5QfOnP+8Hg3RuaORMUL+IDh++ra0on55g/gzU7aFeNbmvStYKlp5cNSpMrZHm6UpIvBJxr2xn1XM/Se7gH+/8zFE1v8cHLc1k5aEKnK+C2I035aIVE2VSR4s6VkxjofGYbyofO+BB7LrULCDQRcNCmKNTHM8XATJd4lszbyuPhUCua06Ge5lBe3l6cYZMJtv7L/9Eobt4ZL3RhFXfCKpYIfOjHW6Rptc+9DskTPt6Zz7egQ197LfbVdbu9c/QuNIM15DtTAm9GT2hRmOSokNsqvqy4wGIvGX5vYp/ioqWwmanKZjEBcSk5u1DHYpjN5xwt57NO2S6of/zmRiIvTZDx4xjw5e0rxic8iKyDHr2S79ryCl3ro1tJTRYutpqlMW7sjOeHSs/RZix7gXCjBfeGqx0uBxQTqc1QV/a6bdHe34u2iI9CoevraYDeM3r22HGTQyc8Brou9NeVnW+JMVgiKPMVoWeUm2BmpY6fYSiWR25QQPTOapOzUeAVU0">
|
||||
<License Date="2009-11-07" CustomerName="Parveen Khan" CustomerEmail="parveenbkhan@hotmail.com" SerialNumber="R4kZmSNtiN405V1n1Ab8Eku1R8Di3ck+ai+SUYDiNL6vb8Nj3LzFfyaoXmOLShsrxH+30L8mST2wJ+O3tOUEaG0XDHpGDmpGBYhReJa8Fgo4j53PjyFv2vuqL74q4f0P/+WIjaRitbpN1cm2xWUlKB8wKeU0+ODVQ/7UKxKbpQgN2bsXh/Y2IrlsmbfphfNPBwHImeNQHGmL5KbBiU/1NTt6xf8GI/RwQWX9gyW0zu/uXQfQSv74sECfMnmpVu8u6lFFtt2esIB9W0NwYHXeAlOkkuBrCX2LOH0u5dp2hYbiarVpaMeJ7389v5zxSjeAD8om9LPRd3TNSIg1MDPe+2VMYMnWPIcf06Na+Agqc/cK5u+ONuZy2pBmZ/q+/PJn3ECaKAvbtkOTYCsIlYLANEHXvYFTTZqRWp+2tthFj1HG3mGtK7VrsTXC9bO5ISue6iUy4fnZDnoF1Gt5yTn44zm7Fi9xcGmHSMCZ1L2Fk8VB8idNpkeopxtuPqK1p8Oo" Blocked="1" />
|
||||
<License Date="2009-12-26" CustomerName="Su Ying" CustomerEmail="a20071234@163.com" SerialNumber="H2GfYz579KQ5poUTxKRWsUd7o+1XSwaJrK7CmwG15rNuo3Wa+vy660rJkRaWTrELbyyIe2k15973P13WJvxDR8myQCMi8Pv9D9k9iblCTAZL9vOcX55g2Vk4i+x+DEDn601kjvkL7RvHug1SYq6GqKm4dnApwlGvbnSebSDwrhh0E5g9I/XA5pa7hQUQwcBoXq6A7e7Blj8FbJ1JBdYUJY7RavgFE9KYfTXn5ceCwPr0gR3A++W66amQdxWnFxyyOFwfCPuZDk+LCgqqAgMyj5PRPcLA3nanXLDLPGva1wa1EEP0qvx6yCSpDURP94GxQGY1xjPlZagbuLaYyWn7bb/sLsYNXVHE1a+YNFORn890tbZ1D6i+wTEa254oF3yKa5GYTQmRWJQR+OXqaTK/wNG4y8dAUisOmQpevrSrD7pQj7ZLGOChmw+KWB6SozSHtIMY665ji9tMP8mq8OUSVSZ9N9q3Zh/xnW0W8sGck5IzTr3JtT0a3iOXSYfijpmy" Blocked="1" />
|
||||
<License Date="2010-01-27" CustomerName="Ruth" CustomerEmail="350771@qq.com" SerialNumber="IglT65DLooFV8BW9scjzoHPvLi8MdKE2ceN6kwlExnq+vkxMRwpp/X4Q7auJGb/LGn9A4XI72i4ZOqxOiEobxoYQEiIjdchBCQYFBOnNarWuNdWyZg+louaoZOJAPpvQIHuENUhcj2kvvC/1ZxfJp39L+uViJ1J4WTCemtRU6pgrbK/0yZkn/3/OloMvmhC3iBB7Tj6wKSPPpEpf85dITEJCJ5o0zLOzYh1qIrfANglDROQqCaz7vwjU+JKVE9PLbOmSkQKTZp7xA7nQ4fk7+Q8bNroghMEBfCMNranp6HDzu+uimJ0KfhBSnWKoBA//VfsJ04GcHuN/SFE6F+Q8n7+LSrj8L0VKJ9OanbBvhmuKbZNXHCz3vgv9iFzOhTTAPJU0jY0ZeSJY08CxfIjiYwVm0+sDFlfk+UT7ymUc2nNBjzBOsE9UxVsoDGnSlxSy2ypRTE+IFzvdrhRVoy0KZ7JS/6o+VhFf2DzWtOYGHInLlKtBH+Af5kxC3SU2svo0" Blocked="1" />
|
||||
<License Date="2010-01-29" CustomerName="Che Xiangzhe" CustomerEmail="cxzhack@hotmail.com" SerialNumber="Grg6ulknpehTR/K9lUMh8cCV+ku2zfIZRWg1nbCv1kXHSbXJjL9ZHDmDuWqhA3vkJrWwOgeW9NmnxxplUjtmEIojR/MwedXA+MtNosw1vKGCxzLB3y4hHSdf1IDvrTc3l7HJ3qoKPIzaX5pRCbTxMVgfuU20NZ/gd6K4ghMcb/5dTnJTHUqS3MS8JROtpdsiqc8wde8wsyG+TbawGqr6fXGEZ9pjDiATR7K9CzGGeIbqAYhHoOsmqtOs9nsBzk1s/d4BNu3nkSp/eoXL7TOzd7mTQd/ZpotwFWnY3tbnatGkB3nMzicm6TKrhgu3d810adJojoWu3xJExcpTB3MzsiloyTiF6xgDX+h8jbDLwPhyy+5Unot1CdGBRCnFWDigZfne32ixcDDlxPVB/slJo1tJO4IQ1Z0tc2wCu4DD6zDIBD1j4RIXfHwft08bL6EM5TEs3zpPVcwSVrnBhtulvzdHwdrG7yWvZ+au6RI7pn/roMe7v+SU70Ge57qr7ODO" Blocked="1" />
|
||||
<License Date="2010-01-29" CustomerName="Soufyane Hanni" CustomerEmail="tt-soft@msn.com" SerialNumber="GfkhIi1HqwEljm7vi5zYguSnAgwM77RUyjPSPj970ICYKvPLUT/x02TShQ+5muGlDRRBJfzZicOhS9ENUwgeRpIhnbUUr3gar17aHTTe03BQlSnDcILnHYlbMp4wQAnbkl8KeDssjwyynmcme6V0Xqh174PodyZcTp0EuIo6S/GFOuFcMHOzqBZLk09nIMsWYOpDHKaFkPLmYyyc7zYqOmTHzGPWHakZfTeY19ennHX+KIzseGsWgnoXWxA6Ztb2FCTba4QJ+KmbUcuCPyyi4yvv76Isg4MwbZMaVifd41uzxSjQo7KWCPazB0xHg0rFvGzp9TivgcZ2swuwYt985zREHVxFF8Y0K3OO5VTeg4DaZomM8ByJSw0L/L+ohl10rJvVooLiEg6JOtIjNDvWEJqwMp9ggcqxQpel2lyixEHxW9TED968eDl7SKI1TNkV7XJvyTm3mPPeMkS/p1P/M/0XqlfC0kI723bW/2+04Bbmo9pXdvg4BGc6qntLrVWk" Blocked="1" />
|
||||
<License Date="2010-02-24" CustomerName="Jeong Hoan Seo" CustomerEmail="virusy@dreamwiz.com" SerialNumber="n7HLXOYib4UJq+g0w2t6sDuO08v3p/6GAabnOHkp8qdjOSHIwgDavnLyvHSwtanLvx0kBxuicZJ9YgpVUyVBKp249akxO0+hU5uPWw7Dryl+4NjWBA21VA4WYjqD6u9VVWF2HCNbcp9bah5rbYU04SNwENctC7hFL4KzAA3QWqI3o6qZm7bTf9+Em4EKam72jmi5lPCoOZM/76FWyPsTAl0KHdzLgtrP6eSTJpvwrst0240Qs1t/WGAM9JHVusVgYyXKQNhD8FY2H3XwF9cS7FGA7TeKmBs8SidulVRjUpcROhbr5W9PV+9tl1KAeDyR5K4kqBWArynb5Wh2J3k6sW4xUs1o5HB3N7rHrOmeeQ7qr1hXRO6NZTQPSHsF+koNbXpNs+hxNUtQn8OslUruG83ORpkQsCb8gqTwlh8qHXc9wbg45EwH1v+IDLj9XDnCiHBYK0REC/3anwfi0f4yOLMC+FmTBMZb2LuGBv+FimR6poCQzCg3R9A0u10csjW6" Blocked="1" />
|
||||
<License Date="2010-03-09" CustomerName="Косовский Сергей Федорович" CustomerEmail="serg_rams@mail.ru" SerialNumber="RhiNldOUGCPRq/fUV6l5p3X5cis92taLw1mlgocSYSgkN7S2XO1poPPj3Nf6+JMC3AzFrZ/rPTGsMvC5iL6+tlGsRRVJgGTJo3Gm1JSjyKWzc9P1Qa9nToYjiQgY7Bhn8AVRYcDgPqT1ITyx/PQDWrQqG09+xMSsle7Kl8c49OpjaYeTcnYUVJcbjKULZxkaPFFmz4BaKG4CY6hfORCFyFFyS1w4hvAGGqCi6rHpyr6nvKfiSU2mwUko+/JuTu8b7AHHfaiYcs9kmmd1VG59yd3U/PIqgH1PWHVS8k625O/h+9tLaS/vVMvQHsXlekbJbcE66CHT4U7kY0KxQgQOqRh93eEma3RQfJx6GTAFSL+vSvvXWqPTtJB0BOvEccKm93FixQIJSTl0AlNr3K1VVO4YAvD8XuUENSDJDdGS0tDNzLTNzaOUWedlCtHEsoCbbr3yFBrhmLib19da0nfabSGM427kEoWKxDAs4nW73yQoJ6GvP6WJXYfqtzAbwyhg" Blocked="1" />
|
||||
<License Date="2010-03-10" CustomerName="Eric Litak" CustomerEmail="elitak@gmail.com" SerialNumber="o/brkUa8LOOU+xw1Mv0uE3MRpDwG8cE6JzVV2o/lzB5q2KmKONCch/GhZINLCKqY+M0DKF6CrdKDBeLs1YHAsJjWExIhB1yoJZFCw4PFkoHD5JIW2dxI2/VgqWX60/FUZw0C0als03fH/YyVmAoORHR3Z9+W6mUJSR3XKJWA3T1Y5TDA7/m7SJ0SZrXYKBOQvrew+9AdztnPQuqwsBJ31xHUFcE6GI9wSV3clpjc0LeWFpCOkzC/m8o2xY62QbddD3z7REPy0TL9hYjgk7gYR/kyVKAH9mKlsL4GAYBCBGytfsItCYP7zNOKSh6AWaQKABmOiGEkZ2EhO5WJMTTKjt4VoUeqRW3E0/8ZxszTZbpjViN3HMs8xvR2XetkJr+z6Djy1IkfcRZg9CTh0CcQaj6UpVH7CYkD+cpVfDDuq/basY1yyh4YMQFY67A9Dzj+NwYYm5iHjw6HD3sULH95JR8H/sRpHOID2xZV9NrRp4TSDmjC19BkbrB4IykxxoBM" Blocked="1" />
|
||||
<License Date="2010-04-03" CustomerName="Jakob Fenger" CustomerEmail="dimlk@aol.com" SerialNumber="Tv2uij2nFG76S2dlkEsDT5qeOD1dohY/rApogAVPBthJ16fAkE327LGDpbHO5FKLwRYoqxt1GEb7mA2690T7OnuCRRddqAEab1+fTm3ET7ducTwlLC3mF3O9zlRpC9/lYaB5bdg7SgxWyeu599LYFuT9fzThPIJQPfNvfODIQ+kmk56i1NRsWzSxXcHCDVwcN2qOg53vaFOU5GV4psE/16MfZOnm09D4FswcIhZACnrJWX9nXDzkFUZRopasp/1lafSnxQZFzh5oldHk6iIqHiXam58HfpL0jUb1LtP3HhiPbA+pqTWy225NryA5NuTSo4LkQ2qiGDkQG3LCUZoKclk7Y6YmSA8WlZWbNt9ZfqJFO/ulZAE7s1BV6uzdiZZYKNAyu157NA28UbwVfnF4eO72KRbKBCijzBVNpW/qiD62UMCo02SbHLLVz2TAOH0alJxWkHgDo5lbJhv8aqoHzVp7NxcemyCYMe5u7fp4XfaDPGwk2eC1MKv65KEMeM2K" Blocked="1" />
|
||||
<License Date="2010-06-11" CustomerName="Zhu Hui" CustomerEmail="zh_tcy@126.com" SerialNumber="Gi7MzU53BwsaCi0hkJLOozY6BkskmVqMeamxawmTvPtvMjQ0YfE2eByFbtjttRE0JU9maoa0ffLnvp1/249AEd5rbpHIA4nVDV9meAQRHP61D0jvPhFLoUPpOZGGM1A9snnM03fAD5bVaod3HOCS6qJZ3/NtujyguoiTeJ8F+u8BD+V9E/kjsUz1Ged1+fbUlrKJs8D7VcjcZeo/APSwjtVaDIhrJG/uT50Aln6TUpOavtkO+FDEAsSp92Ai2bx8+EvM6ZynCBBhe0HBbmyLi+v3NEuy74qhUxxTIS2TzZ4CbiNnAa1+uxOMclDUMH0b5hMgH07wlyKwBwnh5oBqtEVGGs5u3ow4+vLXai2v84R8hGgA84PODZECnqmbwGlZR07OKQjXQlN3FlxH5wJFoEmNODi+aT2Lpdj08eZnxLBXRhz1nnWOnzB4BhkzVODwTJbxr1pxNhqR2obkMKq19Om/Ezze7VioynZkBFKnUAtxns0zGLkYjpq8EceBoa+Q" Blocked="1" />
|
||||
<License Date="2010-07-01" CustomerName="Li Jia Yu" CustomerEmail="wzzhangxiang@gmail.com" SerialNumber="pr0Tix51BwHNRo2VTofILqUrkOSW2wPWlOYgdHHE52vaR+wptTzYEVFR+B4UAUDt3+Hqj2Ny+I86yr+jEpVU22Rt5ZjKE7aer+wi0VXhp/pou1aQFrLhp0YC8HTVRGTm39lGBCBBmS4C9GLzMNrAx/Y+DwUKfkp869V2oU4Cdr1vup++zgAr+UWIjtXkRQlBYUJybkCKBpGS/2Xy+UdZBUMAg6mL+8hTUfyB8qgR3SA9WRzA78DrZXpB1nukpZj7cySn7VMAcXp+HP0vSJ1KNOctedGOVawDeHLOIE5i815P0PJK1erzh5lMhlqML/RARAjcd3/ATEcqvf7Ql8bFzxNIlYpTXR09irI5/PltaS5UAYqvaxpgkS47tCtWfSvryVeW5V+665cWVgvb/eFxGZ3hqbXOT0FGlNfgWnUKzzcpa6EvtzKFxuI7u4I+EfuHbGN3OEAGdkY1pNi2SlWaIVhO4U1sfbrYDD+1ZOh8DoV55ktF28vEgY9/hOmB4syz" Blocked="1" />
|
||||
<License Date="2010-08-12" CustomerName="love52bz" CustomerEmail="love52bz@163.com" SerialNumber="RrBn0oLRv4tael08uSMNqRC7hCWBPEwmUkQoSDqlXYeLETYB5f1QAgDfGbVDXKDYExLiTVqskoeMavwZUY05JoskWdAUYKFxzhj6I9rKExiI01OwpJFgmK6EB8Sb6i/fWFuEA7swClQ3PZmAX6bZ1m31Hbv0oya+9itLnJ4py4mVBtDCe8DhScpx0137oiKxRS6jExzwcsHb+wDhcg9x1hzth2X7VCJY8sQqf3sFSamQwZq9j4ZRdHqHrawAx3PZfdQ/XHlzBO0q3o8KkRutlY+YmXGKgItkYCA+KehNqIfFkq7YnnrqkTHidHijPWpoKItMMbIkO2aBtkzMi9VAmH6Mvkv8BNtmyYn85Be7aPkpyVD8YjYlplqvhLc1XNZ6zbM4pPHF6RiZnFyE9BzEIXist/H35rVvOoyAMtB4k8/LBjCZYBLUhQfj4onv5t5g8knqCgaY+5uzj7qaY3ycyLR5SiMsuEukx1oycEF71cG8j+x4Iluco1Na2jTgFmrR" Blocked="1" />
|
||||
<License Date="2010-09-27" CustomerName="mandana shirazi" CustomerEmail="kaloom@safe-mail.net" SerialNumber="e26Be/WFSMCTppI3MyaoLuT3kCzqg8PgwCH2KHSPA2SzFHliVJqWSd9gzjjOVzb9ywh9d2UrrjlNdHilgi4cgmwtfkej5hpIKUzEanv4cC4LJTgkCrrd/yoF8IY9LC9VqBeu2xwtjvl5Qf0qeOZMg8nMpqs8SKyYLScIrJdkgmmGR2NzuliWOi5T6lMYcqo1it7tEZZylACkKA4cg+mim1jK1gi0hN9S6xpRNUTpZmgKlpNLIvILhc5Iz+X53oiAg5nwW7NHzIQittcqZoVb1CwAL4e9ef8DBWfX3c4aLaKxAjR8wMfedPhKdD5YMNuqvwyKVODnOaqnI0RlKj0OuRsoLyunG+5NZCj8dcnQQm5tjVvAytTnRNET4DpAx+PGdSNk/Uc4n/9WzpBjt1Mm+aTTehljWddRnTbUPR3iS4+4blR7fXt23kqsoAt1qfoBMdTqJt7hB1Pl/uSzRqxQ3qPCUKjRpiorM17+JTf6gmJBVQ1QvfdfNsg4Ae2q0lAm" Blocked="1" />
|
||||
<License Date="2010-09-29" CustomerName="Gus Williams" CustomerEmail="jenny@virginiasemi.com" SerialNumber="orgCrye6L86qNZtTSUGrVsDfcs/qVp8gOnwNeK9fMeaspghbFvlG1mFHEUBBW+pEpQDeH1myBdbtGagvlhqc+WSa2ScYZPnYM2Esb8nt1+tQoGMuCKSP50DfypMMDHWnOf5bIyD/FbpG7hdyVZ6CAcCultWrLfBbr1chxED2ltkzcjF34KlR1xrUVF10+EJSnVlA5iWM6+lt5G6WEjipYeCkzmDjw/5G8r4cF3mToHJ42W8ru77lVd6N0y+tpPA305Sgr6IpbTUNairEuOzoA3Xd1hRqP2qhnNztMfIzonEL/qj4Hbb1pZdo/tBTePmZwSDZUPOtADjrao8lo4mbkMhG7Ww5f/kqYttJnuf3/esJnGqKYP9u8bjH7Bes7litZeeqMud7nKjYKnqpnz8JRv0s+CPFgw2r8u1ApXj6lhCc7fVOEA+tNA7z5nTfDKhS/mFaIOXt3CAPyZoipq3XZsMM0hdLWTUiLP2Ftsg6iYrc96TldYdSwWYypOqtWZAH" Blocked="1" />
|
||||
<License Date="2011-01-28" CustomerName="JOHN THIELEN" CustomerEmail="thielenjohn@ymail.com" SerialNumber="hViiKQd0WDS9THQAIzuRqrqS+NkeOYc/QibbmWYLsz+7gqLgW5ULykogxwHs2a/bJkH2X0+k4IdUY5qSUglq1rDYIT22499XAD6wXmCbpF/9sF8W5ANQBPxtuHSq8i8gsxsftBl8BTJzZhBXrWrIoWXlEWTkzMnYgfbmbwVhcyMnW707pYyvMx3QV8aTPrAKHNLBtZqKxwefguQIyKanyJIU0tjNsPqTIv8hnIMrE/apZCfw1o34rc00KHp7hDx/UwzmBUBh05abkZ7BOOZ4WpwE2mbbXwcFvvGTfl4weAFz/IIUJ/7aPHvwV9OxEj5YVCH899Y8B0KFaTqze2KX2xoJPfiJ0nzmFW8WBf3dGmmVU4nuIFnWWxYgP21OcvnoUv3ZECsRwgDvuuTGnEbKuFkvcMk309NYBYZgaUyNjGVEokdARO1YPTcY0P/3sQFtYmjNI550DB56nE5dmbO26aazsJqzvCSpcGgfKreAV4O3g3j0iwzVWAKZ+dCp5Wmt" Blocked="1" />
|
||||
<License Date="2011-06-08" CustomerName="Qingxuehua Software Studio" CustomerEmail="wuyuan476@vip.qq.com" SerialNumber="EqIqSqmaLNJqIFlq4bJXJ0F6Rw30xSLjhidsYHMWjc9B/VpZ8srjs5WvkVPGysVclPnL4reMMaG7Xy8CSNBsE68idwmhiBpqW+mOTOA0HE2/ZMU7+DcCZyEtmYuwoeW+Dw4eKJSpqWzgP/4sA60Xun9LbblSnABMtb/EGA4V2KQ+aBncBtrUO5tNE/I4jGTpFb+A0p5IJA9hM3m57RQO/fRhpN2uI4OicsGk84aSArPpV8tlzAUrn9i3OkgOe1SuO5moa3JY/o4Ma+SPTgCNY5eERYS42OQfFYmKRfZMi6I2p7JSmIFtJ1gV/J5exPBVvK1NPNv5wLwamh2j6G6pSZ5qOY19KpW2pHexnNhROelSy2t7reSTfvxIqiiClWms38ubvbK5f/Iz6iKAwZNwrH+hRS5aN/YH9M9LS4GnimA1edAvMzj7frpqnxZm6m1f4dn/3EeUAkrH6c3I5ImqvoK0SDONK6tjtgPOBBGFzx5CVEeTkyWVSZA5J1/KK1CE" Blocked="1" />
|
||||
<License Date="2011-06-18" CustomerName="Сергей Иванов" CustomerEmail="likymen@gmail.com" SerialNumber="ET7oE33DZxcDjd5KQRsTHpK4u/UJAegBkS3kyyYrx29le2dz05e8Yej1gX80TMUc4AnX7oBqbOQ9KSnhy/xt63zu2ISqKPpeaMIc+2NOpChdORWTk47pLJDkCHe5l2J0nkiOpTDOXF4exf6cW4ODNhXgxjdpycYANsFcZ1YbGX5wOcJj+XzAJ4NakMtXbu0omTPtNKmkvju9CPetRv/yk6T2nyvvkDKS0VVj9Ejphc9eHppqwCPKAv8rhZUXo1HCFfMk7JKoVbDtLgdycBZW65b6VQDDiOowD0HrLj7OX/wSi9VYXSXXhYGXFnij5IXFE2ralBQdrOwHMPkXp1BEV+zebYroOZ2vMKqy32xiQc3/3noYomCD1GUaNoXsVrF3B2Jw5T8JJg3SlP1wNnaI+QfPKD5rAQXvnL0eonMDlNSuKQNW6adU2bkZfXapkVRNVuWzQdN35EALgXAwWbTejLU4j8fDWbVz3+mAP8CFsSJjihDHqSf3kZa2HzidRJqe" Blocked="1" />
|
||||
<License Date="2011-08-23" CustomerName="Osamu Takemoto" CustomerEmail="osamutakemoto@yahoo.com" SerialNumber="cO0Iy9Nxt+1BKMgMQCjahK0zkGcg7FQuLacoWmXK7eEhhcIyaZxPBxfIvX0rthwBHp7y5ylvU0a0CHLFfipGY64wweYOXgBFfABhweACNlHqoKK4Mg0m/sdDzC1HEd9cw6QQ3vFOi/k1Q6Nw8py4LOi2sFmJo2Llbk7inf6cxyiUXgIXxGQ/xEQywDqzJQYpVVXrGk9qJCN9o/np2uOzlL6HK41yH8gpzLQQc6NmR8FQ4ELsowAImOUT6mQF0VlsfCZMEl/Dj3dtRwPy1xFskf1scq2dVh7h5V5Jr9K1cRkU+T/ayAYxJY3rTps70W1arQfuqTLXWjeKSJxie7T3RXsiHOcYSSxetDdNen4496JIn5njbzW54FfFhnJE2ayPsBHL97gBWrw1xZSLyh2lySx96D7h/ZPd8W4ZiDzzUSz6x1GskMv9n3aaUa9IzKaDUcV17CJo/WJTX7PZpVzaTL1fIvRPoE8R2Q/kLFQBLI1ll/co9JEtOx6K0ACanq7e" Blocked="1" />
|
||||
<License Date="2011-08-30" CustomerName="Victor Kosumov" CustomerEmail="victor.kosumov@gmail.com" SerialNumber="DTVPHffjoGegvLNiudnUZP8SkosSbhzUeSdAowgkd/dSyIHSxZdHvVuzbZ0SLqc8vO4vuXH2dAx4wlLub8dp++OrcDUtAy3VM3+OCnMwM01rJ/HJ76c/qHxiItsX3kYuFR//PwUc875HH0YySMLATLApqDQ8M35T87/Xsw0+SG5100ihsa2REZlGNWnUfwfbmaDrDgp8s5k+W3V+8UCOolIjbE3wff8Uq9ORl5/noqzvsbbnyMPw2xHjx8FOv8sz23Us/C/7iD8mtn/QEBPPe4TmRJCA92krhC0WK2Kj9XxAsclwzXEGKv7DyNaBpeoMEs+NTXU9KR2izUBJuYbCrH2eMu61LvjfrWT9blJE1Rs4T2+Pvvbpvr3FspVjmrNOdMtnsfzMqZCSCnti6lCdOR7w9Gb2IYobrHCWz/saREnsAVY5lTmkIofgqiFP7c0NokWvuWrg//C7keQ8++hFcyGVN351wvtdrSYZ/t4XLzmkqB3eWc0+RHerMNBxAjB9" Blocked="1" />
|
||||
<License Date="2011-11-26" CustomerName="Bogdan Druga" CustomerEmail="balcora0@gmail.com" SerialNumber="o9WO3KWRSWvsEbRbqLKOWKRdzozBZRdsj0uhK7kBgcn9A7ZTUX1sC9UV7iHc2S7aA7/xFb4DeJn9gWr4X/Ijmgv/gJsjkEzqMdCDhso6B1SfZtDAn44oFla+RYnV5oTazQtMOyaLgSDRTAdsjFYGy96SPzbF8EFUjOZJC3Coe2QrGyi9Wb1hfn1D/H/be44qBJa5Dm6wlg6RK/Jkx+W6QYy5QbOKI5eAbWO2HAwj9MfUfWkw9BB7vbYZxu8SFBUeflw0aW5KTRMomWduBSE7CblZ3PZceiWi8zSkUdBvgUQzs1oYXL1GyI+78aeuEePxPID+HHgiaM39LTVd0lVKIcEDo70NSw+X1wuxL+wIdX2C/dR/jSgranKeGUkR8tqlyZtlC/Gu7WbkSpEzVIsrnBgb1AxyNKHWMagIoE+rVUBkm0zDsCRVUG1wBGS337ciB/yB408XSOVybBcXj3JrmX7lIFNr2UbDDfyrXWgmAEVMJCGV+6DUo6b+s67VpwxY" Blocked="1" />
|
||||
<License Date="2011-12-08" CustomerName="Scott Hartnett" CustomerEmail="billing@mercadodireto.net" SerialNumber="EZ99fUuF6sHTLGQtW/Bla7DcjmtlGm3LtOn03g4qrIN3RwgjKFdN15l39uZHfYZEFA+kjwcWTZqOAFgYzCMgjrpk2/RsVsaytKivmpCxax94C8DroiRHt+EDLbSyvszxhtEZMrbho+Cq6I56l8Rx8EY3AOzc35yfe5os5eb8bYR9AtRrzRYcAIEfOEkvAZ4xra7Z34R8xkmujwUzigE6gl6HAOWXjoFcx4TIGOq8qHtkBD1MpiBhRoufX7kzQ2Nu/tFxTcom5jQXp5fkQlOm8fmzQb8GAMExx+giSWrEsqpBrkiS9UO7O/s+zwo53GwUTus6S3+I9g4P/ev6vUUNXIb4vgQvZTlAKwfBrn+BsxXAgR3qycrLhj8RCCylaB/V6fgR0av+IrMWTccG4LPpVpRysQw5x+uG6PANOAgeFZKeLDqPWOPaDpPDCA/3r67HUU1tdfgg1uuFjVkt0+iocYvxOGRKKWUfum8jTjpQ0f4emenM7ihfczMBjJVINCz9" Blocked="1" />
|
||||
<License Date="2011-12-26" CustomerName="zhuohui zhuo" CustomerEmail="hzzhuohui@163.com" SerialNumber="jOQNSWdoxX6M/W/NuzL7wsBW7suovFfOdeMjsasoh1LBFCchpd+7zF2Y1+K9Qj0jZpWAZbkGL29DAC9MFrewbHe0UmWEgSH6GU3tOBYw7PT8dy0GjYwaQ5vtyCBdkBO1OCavdtr5XItNDHQQy+nFabrWrvKOI224xKQ5NhH0ESK4zB/mmCMEtRezikaQXKm4TUTeBlsdnRAm55gG2AnH2o+n9y7yT7iNvDz3is2rVU+nvIQLToBWlRBQmXUNbvcnnuYHtbDI30/cvT5ybwvvWK9++MMBQcbAgqLHGBnu07Nt6fyOcacCt9dAMzi75knCTopM92NB/sBpfls6gQ47dt5plFvMkc78GUdcUqgUdeVCaxY7N31FLlkjHOJun3wf/SzprlUPsUOQ7l5qgnLHbkSf9oNcCUSRxQ+1FhdE/RjXfWHKO6YkVqpX3r8aWT0jQ7z8wiLUushspmhoNLgnrUjQ+fgn50tj9LA0z0Er1F7nIFMAlhV7qi48u1sR3Hst" Blocked="1" />
|
||||
<License Date="2012-02-07" CustomerName="Y KK" CustomerEmail="ykksir@gmail.com" SerialNumber="WQs72xbVPq3fwUfTIna3FhpjcQpcukSvILbL2p+gwk1rm9uVmW6qnreR0130FIae3ZRj94yDAncp5aVMIvyiga5zPwKaDefaF+SMoY+AO3CTtLTYMFcxm51NBjCQSs1KbPz/g3MJvrWB51LfuL4JXrC4SHbPDGst9lhmzpZVeNJmwY3xEw6gaeVL91rMAu4uDaDpgAz/90uceYOyxDfbUDvINBdipmxO0Len24cPoYa+z8Py6xp9ywXxTq5wb8ja+CyTQEbpVgy3K5F8an8G7HwuqS8p2rYA3nKF5Ur5G/mEx1TPiQyDN06flLAWiV+BFelyfaThN3vs2nqObdNy43RyMQ4yboI6/VpoTH5GoRoqtRVPbzxwYgGQTaoWjD4ms/dZpcLXypTKLFhdNxM40rnBIX7SFMdpu+oFP0VdBVmUcDMLvmzEy3y3dTUJ/ePA+FcNoEqojVBEAACSQ9yU4ZZ5bpPL6wN98891hOVtl23Jyl0/rLp+WmDLT3BAwv+J" Blocked="1" />
|
||||
<License Date="2012-12-15" CustomerName="Tariq Qdah" CustomerEmail="admin@hacking-soft.com" SerialNumber="oddybz5261d3cFvHNGPHDI6j1GlNJUOvuPycLS2UirSy/VYR18NbrrEjysIUKaWUEoPY6p1mCp6aLwrA4HmCPB8Sk+YpJWm/ITGpQkl62rbG0ynqF4RG93vC3GteeTFxcgTcPzYmfj6geVl9XNyX3XCFAUzhv+ShF8oFxQDasXmsJSDI/3y9NqpPVYhr8G2dmt8o9PlodwHEp43e1/ob2CZaHDroNdqM/7pp/3LIC1qHKqbqNGLflJ+4f+xCLvCdiPlsvK0B4jMgJQPLfyNfpdWwFr+Ub7jisHf7b10jZxL7TLcikPKjBocshDdWEIPpqGwM3beH5X36N7tLoHa4g8N96AJjTsP77nUnyeQCJVUxypBjeSHOu2HKC/C842hPHie8hBqQr7fR982b1BzhOtFI0KOfWTYZ4kfsDk8lrwG/t2TUJsQY44kkgtKQu4Ai3FlwpqfpxtjWLwAY0uEg7mHK1hHxC73Ip3+MZZDaeLx7QMZsHo4LJj8QeGfvJi5z" Blocked="1" />
|
||||
<License Date="2014-07-06" CustomerName="Ungureanu Andrei" CustomerEmail="cubexsoftware@yahoo.ro" SerialNumber="lI7Mm18n+M6/0hihF7poDw++LY+N3moRiT8g9EkHi9KVbkTE2L8N5x1qXwaNgKjrG01LjDi75z7gGTEP2GbeqCTDmsmX0O4FaYHqX9+y0E2rE+g/vlN4ETvJhA240OA+lDfS7Jz1PfI96FrW40m2kLFxHn/0i7hKRsZIGCMpLXbUWHKWO2kneTg3onSrKdW6+SHULBsaz3kHgLNvcg7MPUogQKnVvV0iY9erYeJVBm6HMmGRzl3FA1w0KAu7E914kcjLbMjADwDRagKLAXc/SutbMZ5k9kS0s6TPocOHCfjrzic10HexmGoAKwAABZRv6slp0eyeDyEMt+wKbMWXTasrKQPiEXW9OALc4nCVjMQmBzOgk3SNTIVHEtXDH0OoOuzzy/TmWKrdUqVHhP6g3R3enPm83tLlyCaYDK+XFOqsbWTj1LrTw8yupeSvUUQbt3dJLw1YZp9PZ8gdn1UILRIzRrCgFNV1S5Ys/LGlJLWvN/edIbfIivJpj9ldYj79" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Frenk Devis" CustomerEmail="frenk.devis@gmx.com" SerialNumber="d8qSz/h0gIhtpWy7mZUSmLs7gEd8ylvdb4PHiGd1GLFGTBATdKPHU+JWxPPMXm22T7KVVb/NOLy4YrEr/lwPp/Eoua3G8VfYT7DIf452fksBockaCbreZFP9nB6MeujouT1TcUpp9WSZgmnrv536RQOF5g8gJml5IgQYXUU7FW7IlsPd9Le/c6V98+bNh2LqJSZvI7VrXAgpvvRrMX9pQOdD/eDJETGOencABMy23e1gICed04L0z0kqTPqcD/eI/atJtl1CDN0cRL+SfnBU7l+F4Hga1gOpb6YPqcOOzMTv00h7Wou8+JxVCzvwUZ/IfzuKgmlfqZuQhOhDLRW+P3mi1sIsdydqsVy6IKsdduI9owNoYxebCa4j3MFO1wgV1V4+k4VVTUMDjYSMDbZFT2tug1O0yOC0NCKEhXkvekHDPoWmo5KpXfevrswx4GKd9gmn0Iu9i3zQHb5vtbdYQZhGenWn7DgCEqwGu/YRIAhGgOK3KluQ0GUuI2PjZ0eS" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="alan nogueira de souza" CustomerEmail="alannogueira2014@gmail.com" SerialNumber="D2DY9pI0Z2DOXpMztJYhKnBpERqjRnYQfIE68Px7vbxkXhG5M6oHqSzq9JZ49Dc1HJW3p+cm/QaDctp8nJdCZ+TfwwCp5f+Gm4b59LtwH7ot7A12VfOUtlzeIhHr5srv8ZBWE7lKApqSRcsR+ERrFon1aDGaPS3XQrVSq+Cg03QYtypE7o1p+xm8cAtI57qyZ4Dtuxq7hjzrYTPL+VRmwZumd9pO5amUYn2vVl2ecX+iNTKUUvRfPnU7CSj7jI/dVnG722TCR9+hE5wSFMvl0OuDwunuzUnJJNhUvFoEmPbfMaDBCwaZkbp+XC0Euvx0hFuxVgYaQRDpPBOMASX9ehNQBCbj8niFsxqteFkPMy+FEpxKEpDD5hZwPhfjPX51Ij0mub8qWBaQnoBMIOex8ECIAc/OFmMQhnfdAV2WozvtvSZB7+ZOAh0BxV19e+8+583kumEBvCm+3caU1NqrGAV2m3+OFIrGb8luZPJ1Nup87UUIb5IolAvPdTM4e0uE" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Michael Reusen" CustomerEmail="michaelreusen@yahoo.fr" SerialNumber="gxlYLbaEsFcZTxCQgKLv8j07l8gWObs6KkSt5LeQs6PpMNYmZpvYYdkzRdGEK/5rB6/fWDp7GEt58HSUyRUM8Bbu7mNefq7XJZvkJsqvE0bIKVWgNJo9gDN1bcWFvO2eNI/CjEWe5aoDrZ/MburvdVQojM0fES4h64QitxjWb1sZMBWclSWhLBsCye6KEkO6R5znjBcNz5VrUdBQCYoq9VkmN43tF5yBXDVyylevmYyjb8zo7KbdNDFI1UjJ0eyKuEoYqSaUn5kqu1UPUrVRwjXT4FkFB5Qj1mMRGQJ33rsGtxX3Hl6tOgcEZC+JVIV/FO+lesptTpAeWoI9L8KN4eIkzZ3XbpDCUbPv9giUa9YOU8Rfx+3SNpyelQvLVPZHMkhQ/zVbDfmLyko1h/T73pyVQSLl6+/ZNxc2wbWuLGFBH0aKpMYIPyrev+79dd/dtvt6LFV3PnA14P8U5lSbRoBiN02xkB7EJtIQ374j05eEjSgu+4UzdmcQWv154sBN" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Jon Speck" CustomerEmail="mgydqdqx2966@hotmail.com" SerialNumber="NyBQJz/zPPOLG7iBkLSACXNRUe5gP8sd+CKbhK/HiRAicVueH20NERB9BMi8LQGRb3cHciYJiRszcZfrZmydNQTkZ8e3lVQVxMSUKpOfonxI67mYmnMa5JnjU2StVHzIdKCG+HvA2Rajp5omL+57+xZi6rNkpTzP8Vg/M0gP3K2I3NmhJkenNTrCobwjw5cJQpMa+9bZCCwo5Rxu94Cd40wVT9VszcQRg4f/Bd2NiW57er8xdSj7yKpWV+sUhi6CmINmooAsB/5wpGJTFAU1cnIOF9B0eB99cuRJbxlmOO62/vmNDCl2V2SJUuk5LuVCJvmY22lAMIAFyvs2cNQe3OrUilHGHLjLqTvu0JK5BXs0dHgifyv5uxvRxtRlWjuhIYm6+G6/tTGrZo9WrvXTIMmjre88zccQsnJ6mNktGjHTMixBXyuwe0CAW2ynGjo7zzdB+sCxujNN6i2W6zqhdVM78fMTOt99/4kwPZg4sOO9JkJrlLZdrkRKbJ/bWjgu" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Alexey Kovyazin" CustomerEmail="alexkovyazin@yahoo.com" SerialNumber="EnpsRyF8mIR49Bj/ZwecCDo8P/jzU5ANkPx7rohRjo7u7NAgiFuz6X/fzoToHpuDSjhCPR0ls3LiPPUnjDbeWF85GAm9wsrq8oGomRX1Rxildu0SgoUPTK9X7rJCEnuwFUqVsqFGVA3/aBEbdVPZ2zsLz6b1te9EyzgzJ17iq19VXzqV3a/PUdvvj2XZTzE+KUq1GHwIu13uAjDuTRRlQR8wO8xmzu96+HtjN3e9os6xnKBipXCYQ0niJBqIJB2X79OZMQqQNmjgyXSGo8uT9exAhBf04W0EmJbRg0Ks3Ixyz9Z6Y83vFj8jYXhGBfYGqk9IeJfGkfI/YcijtBs5yVA63+hUnVv0mCqWKDipW4eL9Ha4oX9O+ZR45sX1HGVZfK/G8QWvI6ewC9MxIXygdNTxkS7rmBJn2NSpyTjNsPrOq3cS72aAjKWiFIuPf9D3AGO9jTaT0dJX12nxx5JPwmNJQsn2trHUlpsn/EbXRBByazRvAq7rsD+ELL11+XkW" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="BlackSheep IT Security" CustomerEmail="blacksheep@itsecurity.com" SerialNumber="eAyBvA8BksYmv5UihtMx0ctU+bBh1dlVBwyQvPs2lr/B3dI43amg51P0h8Q7pX92h1Ul7iPVE4OJHB1Lfy0NyIEHjbigj6muGOg+fZq90vV0S7y2Xmxt6PiRUESqkXwNBJJGj0tl32sSBdjoSjG8bZLR55fCxKyOEtq49/yslKxrCR96co32hVKE2U4wvh8RbiRDBRZs5CTMSEcOG2zxh4aRoQlG6i6ocUMzXCvqrsllawdzMQgLGHVozSLfpWF2U9zOJq8ke4CAaQvSfSJn9v57C2ZVnj6gMCVkbLCgpK/o1w++1HcVlX26yeoswUMBrSlRrdQ8GqPKH026N7axgIgyHf58MPQc42Bg4y2CnFSZEMgae2l0sUI/f3Jd+6kiqpeRPic9McqCtBWdAXiXoKi9llnpjWpjkYO5SBz0PD9B8mJw2FkPkaLJQDKBSZ71ayhAYlPtt5H+lfPIg9TKxOS3b7KjVYQwCEyxAZlIF2h66r1LoZLVLUPCPpZMnMcI" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="WDP.Ltda" CustomerEmail="angelje8@live.com" SerialNumber="cynNcKSOHTI15hPYbSjTAGwYwpSHB2XWYpkfa1Ago6FLJw+ul1fgqCFtXr3FmewwyzWtSFhz+qb69+mZPR5hOeR07QTlSX2UWXdm1U5ox9ImRMG78Nt+9cdqWSEvEFe1DjmFW/BEFEfvM54psKDxdbNRrT5mPhUEzy+URzvRfggxNsIqka9Ifb9wkzf43c3IogT21e+RFt+1Lz9OEZtfOPGANI7QD4FKfJqlVdjWmNVIIUF/1cwug817hs5X8/Ko65qWBdMiTNFCSYYx/vYO5DxH07dTfAj28gg+IInbpKWWzER1ir3FABd08gFEXYzG/oTyizeNWpwygNQjPCUwsXWZRXFoGQUoM9LIcqHCoDG+wSgbi+QjfiUdxLeBZ43/dfmQ23bq02U4SgrShTUuAB1WDoRqFjj50kVDN1IGi3zn2fxumNTSctidvkoZSXBcnnc/M6ALj+o7pZrqTo5ZMo33y99vU/HzkS7sJvS+bZMT+tF9dpWGm7XyVe0q2Kpi" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Владимир Колобков" CustomerEmail="kolobkov@kctsoft.ru" SerialNumber="prQMAyrU/fmlbZYJVmEeWDeyBfvj2RjVhBqZrXPXMNsZOGLB9PwHzKOGKAjg9zXB7ZlRmG2rWhvvvJKZn5roQT7RwjhtANfy5HYybG1emHW+XMfjyoBTRU9AFdST3AIq+sMjGc2juYNvfqh5cKHSPNy4BvdoJb5qEd77V5XCZEJpIs2JPoV/ogIKc7EQAAZKBSjC92HOBlUBTSkARPN7xenBQOOIIC+MRqlrHja6vEKNwZdk3WfWr1HKtpXzaic6nSdaG1H4XD92OzLedvPoHj7vcRTz+wBUQUMFUNFSBzIEivtNR08TbGxKzDl+p2zCArONGKa1WWNEJ1QwSplLwb17B/HkPtuQ4mLVsCqDK7zNH6ZivWvW2m9JLNwCjcE7RDzNvO/Hovi6gOlF4HKBadUhg6m9uPuOuHw20spsbXJw+G/1HUbdEiYNCzc9XuOc/7gSExE69yPFbp7aHH9CV4s5JnQ3/2oxl0SgsjeuDNT/Uj2Xi+uvHbBhhKJCtpda" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="岩峰 刘" CustomerEmail="skeay2000@163.com" SerialNumber="GrTY0inYOdxeugV/kCyW/5b29BIRU0P8WAaD4GFsoC3UpiSFlKMTU3rnaiJ+W2X2GEkyWF6aXm/H9AStFIHGZQqAfYC952pLExhk9t5woBAuwN+dzsb/SKbRwqUzRCkh5S8CvRJvcQ+jIWXBOtHfjnBNu2rzpdFEY/9iYcw6HxBbbVEZ+4Dz8lLD4H553Uq73pN+An3XZLbb+xwn8yqM1UhZpmjZjaPiMunIdzNQHL9yW6Pnse4WRKgxjCAY/hQzM3vWQ9ZOUFJQzR9nJ7DkUsMyFt1GpJMEjPQR2PdrcIXdS2mBGwssII9i5yRWQOgGadVEYmb43nIEEXQAh8ZhUR/5SR43OO0kUpSjB/9IhN5pw7DEPuh6UQF6t6YwdnpElpa9+2MQbxPVL/5WVaZj5Lb46GYe+ildunYVEHbxAtWMgCo1Y2WAPquShXTWcBiYcNK9aZgvrlDvqojn7+btB5npHHtaI9JYBbMzPQz9sBTYxIj3SNPkXd8OUMEV4HJo" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Paul Montin" CustomerEmail="warrld@yahoo.com" SerialNumber="NpSndQnK/2LFUzEiWBthJ/hKRGlgCtfLB9nN3eul52Tb6XtjVcqx1pinkgdF8sHcnxq4H/nsuqBWDXOh6f+khaoYnsxx66V32W8GPmemQsQsAK0FmJ5nBkHWRegelsONLTV/Otm511Dzh5PLzl3kwgH+Q+vIXUz8/nbFRPhssC32IE+xrDPfr0jtXlw1Bui/hrGJ+IX7l75cSjR1+VmsyKFCJWvladloP4oMUCkj/cldYTKznv44/M8343u5D+zQLxoJa5r8TLTso6PV5NpVDhdB7u+r9snlPpFKMLVaIdkakPTiRn4kWiWyYq3aercoLLZ1WZbTpHHgUwLHhoEJD3vXS+Q7VeQCVJfAYBwVqluEaAjAkMXh2JPfD0WYHQDadc7V+JCVHJ/NLmxEyXTHCaM/tvIyCSXYe4cIKsuuT1+9xgfrFLPY08z0LJIvZAz9MI3aqGav8Jg3Jm8DfTPcWigNnUEBAHB9wsk2WTuSwE8tz1MfQLVi08CT20wbNrlX" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Christian Searcy" CustomerEmail="Christian.D.Searcy@nanvkl.info" SerialNumber="cH6TpOWVBGUFDMFmx4Sb6gm+GitdCbx+eVbWKOLnAGu6UcFlPPxHdHk1PoCHnmC6OqJ2zkL5Zb8ASenL30NLdPsZggmZu4X0rMHPdr8EdBvwXGduiKRj2M+zoMs2W/aleicrtxxoMd4lgRJuTridVLlzuzt4kzE6AqC6atXH40e/5UGaYGoz5gmszvfUmncVtCMxODMxz605vI+oLp0xui6FNI8VyIp+/5rx4oGlPe2OSHa3CsmCPfQPFhfFV8gPZGg9wYue1aopFwmSeV7IY/xtoIEX7YQ1THQH7HZpnjbS8ZHkRQ+u1VVaEzmspx+YZq8slDv/wolVCHZdRZEmjtNowf84ZybLEzRVf6wuveE4pKwimSBa6Ow1VfSuC34NHHz5c1m04pzntOHqsMoqWO+INH3fSfy5KpUjC0AVys5XTC9bCNHlTeM8891vhSLvfiFUtqAJP0XL2KQbd6wHwdngtntTiYrcJjvQiQ/MV26XVzL3jssY/t5KmSZ7v3BS" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="skychenxian" CustomerEmail="jin7nm@163.com" SerialNumber="RATWGlvUMeVRJxjXejpYNeuFMNP3tEdJTD5SZVnqjvVm0TM68UQa6MfjtNXMcIRmUtqDS+aeR55RPiMn8tNSdydAf5vOEOtCFyiQhoJg3hXDj6Yxd/x4Eh/CbO0MRl41l4VaSMv71m2/ZxqL3EgoKtG7SY3PIk4Me2D11rrMuGuiUzyDITg8utF5Dny+SHmt+AY4AcPHH6oT4DyvClO4Fqz1VTwABAWMfBj94LPfqh0+axupo94GroDUzFxNJgHukaiHmQVJ3uXC05fuUQyTYOvjQ1+Lfnop32vxCEzG8JS8vtOT6N8c6z6d1+YZN6cHutKjzPO3wmgWkuKljvU9DyEhQuYDq4GQIilUX6zMyqkvg0O79j8Xtf5LbcYuk7FUi8mebDdgKDCTmivIMpU38x+NoOu4GYfeJLgBOJ11EGmjpqPrnOOQGMXkJrjfui1vDTd87EjPiWPjpA48qRqoX353xwHHarT1eA0VDCRTnrhsEoj3sVDz77nSJHerJECf" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="gokhan besikcioglu" CustomerEmail="gokhanbesikcioglu@hotmail.com" SerialNumber="N+SRN0glO1SxA0rxeU4hFvhdj3UWGOCviy7X2yV3y57DEZ9Pn+tWYk6VWJpRr/333kVNwWB5SOHxQRnw4jcRT7eenW/F+VcRM57Y8z/roX5a/qulE1/QIOnNCuDvVrjzDdTwscg4E3YVpzjxJXLfxoFeR9LpAcYeDlNBwzCG2XGPf/XQc2kW/l3p7Axj17+Wr6p0jQcEQZjqwH+hpEWM7GFUGpVZcuKXuIDVNsMAesLy/2spkABzVNGnOgtBDBQQfEeIGLi97JGrP616Tm8gmAMfX4QLDKRZtzTNQMIkgULH2MADnvZadd3J8Jm1pAcTnvI2glepUGuOSIEktBqGDqHvAaluOUIZ0OPoW/QW8KupBtWJi61j7ElznmLkAx8v8o8sP8QhwM9qIm5AYqIN53QtC8j5W0zdkMJgd32jbfAizrVlRtRO8ECFT5PKCIDgk+wu+f1jVHG4V9hQ6sz4M0zGL7hIJK3guJ1fS9f+YisOruZwB2EdlZgWkKA0jIWZ" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Joel Gross sant" CustomerEmail="lanterna.verde.mem@live.com" SerialNumber="BNR+6Ql7yZDUBKXga0Jq2MXMVqsVlbn/7zt2sn8yts+QsSrSsG+w7/hVuuOJx+9qvK3ilz5OKtJeqi01I9KIsqxe75/mBzna12bbmSMiOt//1Scohs5ROtWlJnikISAgmPSG3GGFIFFq2W8zSmH4iDEEWs5PlW3kOKPTVN+6/yFQSh/qfWYXyt3W/rFAVJrC3styCZIFKixPbu4Md9fsQrab/WFrmygQdiX4VPLQ9VrQoQ/ixz8j7P3R7hiKOqFsaGo3RmB9cRSuW3dEhrMkeFaVsJ95hj1p/AY1KiuI5ZRs28zuv5b5C8KPtbwC3FjrFgzc5OdDXRa/1WNt9wuXjpPQAAvp0k7+bYHMjDC5Ucde1RgDEurdllmhDj0o5c8S4CYpcu9OTn1jthifALi+PjoYp2V5kUOYaT5AcBfXBGcz7U+3jPyl1d074PGAzY+Oq/clnSJdEcduqCOXCKBg++SIU0DGYZ7Ewp3YAc17+eFDNi4gTkeYaAVhDet1k0Av" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="luoanding" CustomerEmail="1915279194@qq.com" SerialNumber="SyW/uUSKhlGSf6Fee6nzY2yjA+FNoh1pCs7tx/oVvzy8AmMgfdGPIAKinrMfK5Zef0ciDDPamoOoLNMfZAoLfEUrTGCcIMN6+obxcySIpi/N/7O+dMnbr/Lok9Elm060U1zNdLUvpYJPygffNfcDVojg0Zxxd2aAmwFvf220N0506A1Jp8LvQdRwhGc6n2l1KMNgejzw5tUsm1VCd5d3bzIM6ypStdx5tbEUaavgOwPn9U+81yUtJNFQci1tQlbD6nHxcX1Ur7+hfdJSCrfz0KM5PYbk8icZouGSikn58FKn4aYPthrI7/64cSIsnFas9N1g0HtcixEog3QarWgStUF280JmNSbdaLb/V8UBWLjw6ka15kn3PrYd5J9MZJgSctcialJHn7Q9YolxgntkGo5Mqy8edcYSTAoVW2II4c4pfnfQyg6UEzTwcw0zGQzu/C6i1QK5IJvz04dxUSUAEsdYQOD9stGXDbux7pCvyFDEQ59tMYfOdyuirrb2NU71" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="LEFEBVRE ERWAN" CustomerEmail="leferwan@betaupdate.com" SerialNumber="oKJxAQBBCyNJVJg52kQ5gosGU5OPBGNf1//rwwG8WlGGNxWJYE7eJ3z0cw8gzhG+oqik6iUtVVgsHYPBJXtsCdIDZcWPYQyeIz4Dz6uH4b7NwhgFv/atE/u9Mbwg4miBLVXIWjSGs2v9qX8F9/uCDPAYtBGCIAhS31nQiT0J7q/LUXTbntXCPpp7iPQJHpJKT/BG+BlBcHRMH38E3i+KtpiO/RVED5TiYGJOX73H4bgK2gQfiroeJb8hoLpjqbZ/ADPzkrq62UfKOCd+njHKA9aZrfixxDc15ww9V8I4n3LQEOZK6O1G3Ftd2NW+qXKSMPkObbtjz+nUOQB29a19c67aWJKUhjp70f/YyYBIebTgfKFZAVlBQzDgmikMJCfNgtDbLzrunGTrm+C0kMIAHCJ2X05ChRrn5VnO8Ry7ZGwUjhntc/F7ArwipEX2EDQ/pgKnNL45n0I7GzSQ1/6YAWA0u7hFQbjMXj1Wi5HJUuXbW6Xu2nsvZFAtiklAgxgH" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Daniel Augustus Bichuete Silva" CustomerEmail="bichuete@ultralogic.com" SerialNumber="fWmzyhLjLX504DdLDC2fcKsHij33BhmqyGUQycNAim/CqlBEykgwGNbTngtoRbxrguDuW8StLKpqL3cQzIIEa+PhLbzXZC9hUmME0K4rf2OIGYXv0AVsasLzyUFHJWHU9kKKBvuPU65184Ky/G9q4PlVlRM5PKJPHM9J/Dv7NAibpcFvTIoB/08rGyY4aI0dEsM3yFe+kHWxLlXh9VxUssPVp57TsMk08zkEoucQweROiXnYbApzTGs444otJ5VKxw92hYtTQnO/ReBcV9a1BystLWhehDaKscVLXYDhdXggfceF1GS8uTLKwOTNJlTZIkxeG7GAJ6ahUG89GrgBTBO3xl1WvkbvegIbGCRMc7/udGSH036BaO3szsYQf7++TZOvyy3ADRjWnc+wN6DhbVUQm4Uvaakn5MpX6+LVlXLCpTvKYnHrs4SAjxBQMdrPVOl9FVv+yPsi5OI9F9Um3e0CJjYPtVM85fiYH2MzGxtxIrbMm2R/J/AnZcUu4zTE" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="nguyen minh tri" CustomerEmail="matpassrui@gmail.com" SerialNumber="UKJCTJ5Prjmzen6sKYMg9l3Hgtd8wUgTivB//2Djf++TqgQ2HelzLkMtevRWS52y+kahNxBu2LRhf/HS4sXtkM5IeWeVDew0+tqKVKNnlqpsxWBOv73ks8bD34C8RG+3fiRqlC6MJ4A7rhW1f4pm8BRTZVg+1g+Xr2L6PMlMKw5YPS8YiKzujMdFxBpEZ4PFundLrHuLBDWiDUF3h/IkxW6vAjMqnUi3sibMCb/1t3wHlnflPFU5KTO22/EuRHGjRZq0Zfb/aulSwKTW19L75j26mCTF6jXh7flhJgYmH8XHA7YKQGFv1w58mNbH22jt5wLHf2cUtPfMhJJQuoiWA+z9itOWxzwJb7/E8jq7+ejKg91MjMTeF/U86Atz/t/AE++b5iloEFvq9wPAVLUY6JzuMVSMaxrPb/uFcGyNmOLdrDMdd9T0PmHbXA2jGshFBfXWBiQn4/C+3XxO93b1DB9JvOz5nTafWxzs146wPFvWWhRWMIJhwK83pF0NXgQd" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Bob Chu" CustomerEmail="4640814@qq.com" SerialNumber="A4Mvp2ybEYjQaCtn+ZvJ+DhkIglcq39TyAGF6WV4znN3nKsBbQqcTDuRTqgDW6nPo3BQ6821yRF9B5oubKRI4EKbpoNyRMexTu99H+W0PnuroaHdq/+FuZorE3GT5wt8mtgzMHGe8w8Czhqq173gSaQ03FlnHYD2bdXAQDMw1qBrxud1kTolYc5EdtHP/jJzxQHuivA2RYjqg/JMMHOIzZgdoXu+Axx3k5zeiot4PuMT7Xd+Q31OiNytjuwoTcI7lcT1VbjEJRYeHnlPAMgHyvC4B/ZdsRaBzBdAOD8p2ajWT0sx1g8H9cGhuQp88zVpk1GBDKD2mpfrlfNBGEPqXhC9S2GiciDhPz9ndGjsyojGhHWU+1jwMadC67XGjrxrwiYNA1l2mPRzUjJbIUMi2LAwBBIR7HAn3At/1a1ufHB3JviWg3LrmPUJpnVWz+ma4VmXvfTjeYeYbiwwQD41Iz/t8v3Tkq1pogs86Ymi+bajJzOFE4ma+M/wFzESv0x4" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Rao Lifan" CustomerEmail="dxfdf1@163.com" SerialNumber="VhYft4N504WnQ9/Y71eXSecchyln2mpLt6GZYlP3I+5y2oGtzr4FTOJr+KRu/9RlDFDOABryqrSBIL2yxXuKzvfVae1c+GpmlXe9gmPOFv7GkZFU0t1IjEgtdEP2Llwm6xIMIuv4r5AxqtNAaAW3i9OKNhPpJ1N2JWHq47wZ9c+UnbD+bxN3Z7QDt9tYFalhRXfVdEcNRi78inKJZesfAnvH4rnn4CSG+Emr5CemYGt7Ls2cEI1PRVjKIHu/yZiGozqPvF/yGq7EcIP9bbOGCNr0wxWQyObl0+1xy65ofs1jSJuuMstfOAXjt0MkplGihL+3RA2z+KdrrdEHqTgRyMhse9tV4XdyzTU4dQqlXaueFmXpNpCITzQbqgosq8jBfQiKlFsxaoE2lXgKumqDTLcKZ2NecOQ92VYWER3fFAJ4MiPAyPk0/vAaL9PX7JZ2EtebK1GpLgxJAUgxUNDnxzak2MFyOqZsUv0FJZU87cEKWBu9HEKqm7aUavrQLe6J" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Коновалов Эдуард Борисович" CustomerEmail="proallex@gmail.com" SerialNumber="m45icqOHjeAqjiQikfblSwwvMOujIm1LJbALXlBa+5R8ylUomCy/MwMbyRwaeN7Dyy6yDG+NlrhAnc1O4TGjOWfpafew+OpKbWd+kdSlNRNLfEdYB5coblCsXeMUckEHUgyvB958Iw7/VpDYv0htvykjl4cu4szvPJecvIkuBvvbRRdFl5Fv0dD2wWzkS5i1bV9pQ4m7vlyWM+rdG8wAVI04zI3fEoHu+gDvKru+ZnoZ88TwyYo299G3KcJFJGkDferUCOqKC9+4QC2brO95Sfkaai3aKP6IBZ1f1EAENyXMYauvJ6TgyLRIV7ulyKWj+e27vP41Y6eTtKXN63DIdJg5tSBaXAuWoHRs368nDMl+XdK5K36xv6yvJsWkjR+cNdrZROINB4+eCupT4/C87rEk1q7OamaGfpX5tyr9s8oRw3QZAty7MhQqkset1q8MX2sASOV3iYX4w02v6QPUOjRBlwblWIiugudaNowpF85hIxaI1x9cfdXa+VQDBnBN" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Mohammad Sadegh Mohammadi Noor" CustomerEmail="msmn_13@yahoo.com" SerialNumber="T28MswAzppVJxsf3uETCcOme54EHlqaI9z+46UWQbyGALw0r3HjYvpiggHQiiqz0rz09yyS/sTRkfgW6vqsgEphTvsxBo6XmviTZBh83KonB1YhpNNcWvCQjXUsTmxXB66uXjG/XM8FVVYOMJHu0tMIYMQECbEwmXqh5wDZaROakTgarClCjtnEMsXxGvxI5qUuj9baI/3Fz+LU04dIHxutYTqnvDOfK8qnlIu56CaYmwSOsuN/mBKMpPvjJWTn7Z3NteilYcfdUDQDbKmgv9OJ0mR/alLUNsMmKDxOpwqRx8oep8ldXaq8NnhOTg6dS9cnIdcZ/8TKBTD7oX1P8EgBgxiJ340LaSBP+M1mvtdvaSJC5I6ikl6DOc4wLEyM9JuWGyFBkyPoq16Hg1KLh5vS6P90Ti+wN5DWMv8t6kcu33z6Ikq3gmcBzIK6nUrkZ6pxD02zitNuph4hPo9mwmoGrRUhSug/ZhmPBAsabXT8tMGAoMibSYC4cWEuPHTWo" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Xia Mingzhe" CustomerEmail="xiamingzhe@vip.qq.com" SerialNumber="GD0Ft1Vtfa0s5xhjXRt+/qtgkmdy2h4Blr7eD1Hit6K3WyTf2jzIUIbuXeCFxM/PSabyXc8PqQDH0N8LY1xSeEvD3481UWah7ouSLOWnvduZnNgWgKxXoM4bHid5WkwoRRNcKDl3pH4/InZb200/qkjfVOXzy5uepnhbpim7qKrC8mI0ojYE5q/EgwO+wUweZNyCLhTGKGHJlAWFr/KR+GdOT7GwnPr2lgwOwUGtrHzbKihTVFlK1v5aBlKwHNPhvyAVA6jW07kCCWYGMAJZfuu6U8bTYHa55aCXjDgu8VZbXNNv+Fs9ZEd13lJUU5yoYpdRo8jFNhRgPh6ay1GHTYrQ+rwLGEpPLc3e6ed97DGZMtrM4XwWpjoAJHcvGOa/77CcQSNbEtLhsrrEt/B3r2D24jzRAtUMBwng9odCpLGCAfsvWuhadGqe9szIbibtImKUefqUNNa0WsW4U334dZS6g6Du4JKG3eNbnaaJCVQuVoBrGruipfn06ZTkIHKS" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Кудряшов Виктор Иванович" CustomerEmail="wwwall@mail.ru" SerialNumber="GH/s21Hs/s8wUS4HM1VxbNUQqrXSGZXz9ztdojCG4Vn0M+p67GUbAX+zEgh4XCz9Psib81jIdF/RkG8oYu0CfC+bUx1/608TeHdpmKfY9UhxXB7tVjbUDEQQHx0EMSO0M9yiGiWnUOiVFnGunx8UIfV5oRr/oMqX9Du0djY+nrmunSFLbj7UBCdQkbMFLse9whb12SGmq0vkk4DaJ6tBcKdL+1Gt3/HrRsGBeXEbAhuNXLdp+jhqQ2/R7T4NGlWb0c1IWM2GpGYStzB37qpCZ8+8tvbolpjONvdIoqo/c2Pv1f7TtOJQ8wm5t4cLpF6/J6hStI7v4GO8zg/8oP5uXqFAKKEC/KjVyO4ud5TJAof8/ijo9moTnQZmLS1tTr3OFEkxp37asQr7o9Fn/xVbS/NiVvpFBQKiNb7GyvC+33BF8OrSKm6Y/omacnhEFdLBK0OCCGdASz8gMuJzoD3nvy5+9jWUFFrbhheyV3K4ys2aZtwR3PEWBrvYFoPv4dHB" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Zadorojnii Taras Volodimirovich" CustomerEmail="shwark.power.andrew@gmail.com" SerialNumber="Sfiqefqg+Znoh6ShU7YD5h3i/aikAshXg1//zp67ac2dpmkpcH57OHjToTbKjNtVsNYJuBY6RxtIkqfqIbV0ouG4FXB9QaVDGi+v/V/VNR83iUrhCJyhC4gEWremxO4uTz82JwReoVLL7pRVGS2yYZgyaTeN0okv/xhEy1yeuXu+gXR28uEi+V/6eYMx2/ahcMBM/giZ2u1biCEo9PVE/FpgCpg/DroiK/x4wMZTwceTraWr29NP+sM8NExh8adDg7F6WsCZR4jpB09Y5awgGiW2SM6N6+uXjsFE9imAsYvKUSCIznOAn4np6ha5049yD3X0YBQbEn29pPTwKwjBvzBw6CzhIZcuFRvlCmkrfZFEKiR8BSXCxkIo9PscAJp44ds/PJtzNbkC0SkcXWlTKNsu95tOMW6F6ifvU+1j+ziRzR2SMzAkyPV0rGfadLYUaI+kVgcMUvrdZsfryZkqd6RtpUHoQdmkiL7cPXR9ss8xcdQ+jVWLb1Glr5PdW4kA" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Калинин Александр Михайлович" CustomerEmail="clearman85@gmail.com" SerialNumber="NKhJc+lczMyeyz4F7oysxQiTuGWPZnodZU4BUf7ruVnIkqlRvozA6zRY43O7v+6UoQIWdTq2bY6Jss/wrcy+0j1oTZQaUlGOZ8X71pPDJTLY4Rmi8PpF/9bOQV2cD7CeeosweU4hauD2FLjG+VKOjw6CiTeKGW2YRvS7sycECxUvecS03eVMZpihmH1spgE9pWe+4g1jPLCQiStAmB6i+IMbRKo1DLYK1aHUaufoFyn37HjdVJq7LJvcZFnJWKdUYx4otiUEqPcRn8nYbToH+lbWignBKKzs6Jzgtf8dDcQ2brBjvL6tDDva9OUN0H7GjrUAVnHFkX2sqDsGtDdYYfF+N4/BCWHis/ofDeptTnDpT9II09wRTxiu7XdVbnUbJUFQjyAFd/xoUdoy866Ki57ymSXFbijK12/UNY52Af2myTe2eNondCm9LdlU2c2NTYo+A06YqeJeK/qjgkF+ac4Nxz74A72Yn0mJQoRMuxKtxH6hR0usCzSnRnaGQKZ7" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="Yedi Luo" CustomerEmail="rd52099@gmail.com" SerialNumber="AWx7jBQjDYDFUX/j9h61oqYji6q+M8CJzvLj01WatRNbvZERhTpNFC5rgrfgHi6Y7TNgtXL8Jri3hkxl6ky5jlVrauCBHK2tXPuLOBdjYs/X1qc7h60VWgVG/Gp5ADRP1B3Qo7XUajZyM5kWwTg1UtBH1zroe1wcyX+iGB9xMbutOkkExXCFcNc0OmAgD7t77BnZLxDzqmdXJSZDS4EfLheMR9zLNC/ZDxaqCk1JFmnoCW8t6YqStLtfCBL64I6y+YJopH6C3dGdPUf0bIXhRDKddi109OyZR69jkE94DR44rNwJSG9glFMLAPWPjJGzpvEtgSAn08aTFGCpo7PQ3A/ud5kk2wDy868ePesxzBSYDSqm4AhWHfcPhzPhf8jB3Axy0fq6cCcWI8JfP5HULOXR0skXCC955ycKeWzxDbOwIwVMNeCLQVGKdbMd7ruDEMDUmP6tJJFFNjDOQsJNzxlgF9Q54OX6TUg3lIAG6wv7nmFM1QhNPGVwpQZa0kYw" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="William Hanna" CustomerEmail="nonstoppped@gmail.com" SerialNumber="RYfOLabiWeQ8mOVjfIlA6KhEFdeZlrqzxDE/NfqHld5cavu0aLS2CYTGYa2ahNrWUbZw6Ykm/Fz4jHQ04tiZZMfLNQ2S6ziTYu8yR3PddIC0Sn1+EsDN8L3eHgaTbXkj3sICjcvP2irNfhkrLFNiq0W8E6dYtnjXboHpkPYHSnf1wZzQoyHtKgWcs8h83wFRcdypf9GOVZfi3J/3NLU8eLjL+2VwuI+FQ9pvWA/xwtwdML/vnsSyl1rH2sf5BRP30o0H0BjXSZBe5VPpSs9nAYFHyRkr4ftDlUPntR/IUaKFpYYQSCtDg/Y7pGONWlU8xG5MDjsOj1y/tEjE3tWoD8J36FeFICUAu/Xa3bmqGtfjVDmbZXbcg3acjACTbCYNUqhdwN09no7+BsHlnT8etGZFg2ME31r0INAXLH8CC9/gRQL4+9Q1W+Vj5Bit9Jmcotrn84YHqok386aaq0kbTVXQDSwLZZoRrzSgLR/GpSstNA1LnvKj9G6wKRPHnCoU" Blocked="1" />
|
||||
<License Date="2014-09-18" CustomerName="ludwig schrenk" CustomerEmail="aschoenberger@cis-rostock.de" SerialNumber="EjnVqSnH3gkuqjP7gGoGIIBHYGNcWrRNPdXXG0kXTQu8mAiEuIO0J+ntmv49RlwtK7PZYX0BKJVX6ssvlQXvBW+D32HIen/kZmSCd7DvIpzWVD2dB4+k0VCTUpu+m4iUddyFaAtF6MvTgP8QA6+up6wcQuYoNiWmtaDiqozzyPjpGf241gQ/ZRpYNHdAfhPM73i6zx/R6FMr06w9OHWO6TRMyIzU1/mdxctvW04ZUcpPN2ayojD7LyQ81K680cEeZSH/c33G2KEOkE7wDaXe1RucEpq8KZL/bkfex3HCrFAsFEzWAZcu3y2UbQQ9zkDlwASFy5mZevn+nSV7v7rYraiXKlVXdbMjozkzhUJvILtM3jrh2ITFDBN6T4qNmZoBnrOHJf9Piwb98Fh4OWIzyPkVPpaDencmEgZ0ekAkdeb8rcU0pixMjDD/FRl4WA2HqL8v7tq4EiqDCqThmzN1sgNNCCWILmxRxs7Lsz2kCpyz/tqxjNUB7lZ7qKe0w0tB" Blocked="1" />
|
||||
<License Date="2014-09-30" CustomerName="Richard Hill" CustomerEmail="richard@kingston.ac.uk" SerialNumber="FytTPogFTK5nsa0kkj7WlcDQNZrTEBRdNTrJlWYiP9GGd+VOjyL7Ye7Q3ziQS+yxeln2YaqpQ1/mAzAtIwP2KRq0lNl4HySguOjy/Ghh5owxn71Twv5ci8LZtxw95d6OH0kvj/3+yOzOZR6UVXhSWjDf9OoumZom67WaFDVe+tBjNnCq7mmmRs9IhaHfiTv/JbfQ2EUR3NWSFeSc7ufJFO2+cfpqxtnUE4Aap/LlGw4MUzOxwh9rYMmwEfnUteE+JPWmNe78A9Oe9Vqto8q6Tq5KF1RnVDV/x9hvz3iFb/jlcYdlpLCnRvA98PuJY2t4aHr64ErapoCbZCWLsSS1XW7RQg9L6MyjeSuvGBvYp+n6y90ArR6nxCVHJBb3t39l6YpvE5O8OhkMgAfM8LF96zQJIp4vHB1+ES3pkttXZzIfrz+HnFQ3aNOH7IEderLmDOsENJWrZCNBiyQw2J5p/F8xF4CdCaYak7LsMPMP2gmkwBdx/jBIXUGwcfrCta9W" Blocked="1" />
|
||||
<License Date="2014-10-23" CustomerName="han qi" CustomerEmail="185542111@qq.com" SerialNumber="ZcB8iJaHlUgQABOhv5I7B/CB7Qwj29AOuXr1EmoD4YnmgmrXGXS4K+U4rMyWiowqgirGmxjHJpziqrXI1W92WAK83VLHpPFNkXUScpsmyYomoPVly6rf7eNO0vYSMLGmz5XuVldUBSEL/MMkA2EY/Lnl8UeIzO/yqgVOzPx97jDsJPxW+Ll6kwRzyc0cqeo+xGiBJG2d09J5cwwXenHbHd8V9QHx92MEISnmXq2pFu53fbAt4PYUb31hzOO6LtDlcD1SItm8r0B+j7ndQIS1VDxqzcAZB6TCHfxeVeeZs9Xs8jnMqRvUhaC57JqZsyp2yJ2LsWxJR8jUjN7uWqJUTjInh1Cu/QsZoXheEYS0wYEJcWuHd+K4Qc2iEpTnLchT1D5a0ftKSN3MzzRcjJxQmW/+7+t3CdaLusGyMDcdBX255t60ZOHtdUxyyYA7eN0nFsDajbWXLDRIs2WVR2C7+VML3uGNCT3RctRltGelnZEa2VR8S7iPQFbl1CclxkZd" Blocked="1" />
|
||||
<License Date="2014-10-30" CustomerName="Петушков Владимир" CustomerEmail="mintrabaljahal@yahoo.com" SerialNumber="DIGZlkLNUB/o0AABhI6S1OPGAr1Pcn3sEqLMJlMjqy+ANSARcrJELRG3rf6dKMrhAI+kfJEBCZoDGVO58ny9mRK+j1UwJ/cCrez0iB4Dc2KppT96xoyb7rSZYVmvS3cF7brwjxCQ+Za1WREAMr+uTyqAkZ+x2QKy7PjegEqlUN/+AaBOh1p4eTSC/VQBgFx9tkbvoXGxmOSweuNGbvLsMApar28fvbuYgaMf+4kdee0GsJZgxkgG3baV49+JnMcQMzclD2G9NV70n3Cv6l2AFuDaM8HKQSdNINFJC5kZCKUv0t3huFpXDM4Gh+ejLUhKeiCSdFHm75IKqLsJz5Rs0pE31IjG8V0a1COK10dkvFb82c2vBYnFz4o2f5VnUAbfvsE7TSODwu6dG8+YMzVy0No9i/7k5LTtdfWDmeDjBm7XlXIYUYKO3Q4F7HVyhqjFiHZ9rnbD6bRTWE+oMj+/DXcVP7JViPALglpOo9HLn6TEP/zuc/8el5JgeIahv4pc" Blocked="1" />
|
||||
<License Date="2014-11-12" CustomerName="Julio Alves de Moraes" CustomerEmail="j.moraes@lojalotus.com" SerialNumber="ez0o28KF5nxCFm96a/WTrEp9MLPfXVvJFbxQQhrWIn+DtlY5ld7pV5KrTehZP2mSDFp0432JFyBnxF7ySI1ut005s8ijaE+Wm96aAqJ1fA8lMncn/SYNZnUkbqoo/v55GbzKjFbSaeFbMKTEiASOAzp7FzNEUx3owIPL5WXcnSLFRsauwaF2YawKOWWApp7Xad+f73imikTDKZ7UbJnN/JjioXttcosna9d9yBS1s177JUtgefJ46ZR+7RoFyqVM7ghlpphAjpHCWXsIOWoMsILSVAyMhvv6s6Yt9VH5okipANZhgTCfTMjX3B8v6erTAOgEXHn5ALWu/qI4rjp8fmqGDVrs8jvO7/VY9ew4Z2x7n59tmboT4JICdbu+DYi6+3lYIZ4T3nA1vN6M6DKEiCHZKNhNc4EyfC0PRP+8KDQ2RERsUTURE/cTIeJ+F80NN53/oKbCl/VbRgduYhGd8BmxMyExo0hcDpb4g6oEuk3wXiZfk6T7Gn3kgHLBx6WE" Blocked="1" />
|
||||
<License Date="2014-12-11" CustomerName="Marco Valleri" CustomerEmail="m.valleri@hackingteam.com" SerialNumber="bymIn14SwQAZM6xvbkoWLXo9OUNCbPsdEMNBVWaRLJT3pdofSROrpYdwDWpvtd0JT22LNBRlLiqOE3nFgqZfNRy771JFw39gIsuDD/qgDSJFMu+TrGiTc9a1+YrYPGrS9XDiZYEjbS0LA7MRN2Fd0WptD921nDXquNvKV2LNcHvr8QzYtPXTdIF7p9W+xdgm2YYgpwpDdlSjmTBGi4MXdVwxt9WtM18TmMjMlPbfGsZZXv3KOodVwagJC0SL3AR/BMDEEwkZBKuUpV+peW5EyfDU6EmuqxVzKGODgdFMdS7NXYxVRfN7Wsbc+3PFtJ9rgyAvjzGlL+q9+Qj6xWkc7j0zdmHYLjUryGdGffU2zfy7I8kUZN2Pr4Vwu5aRnO7G/i+tweVED8WJwXJY/OOVA1MARTc7AGyjlCB+ommR75l7DHXO3SEzKJj3gTIViHiHz3cPZMprU6j8ykHgxinOCFbj+8tBl2r7zN25AzTSNx9lTCo66IVt45iGUe3N2Z+/" Blocked="1" />
|
||||
<License Date="2014-12-31" CustomerName="dan ke dan" CustomerEmail="793754433@qq.com" SerialNumber="Gl0QAIrGNb9Inz8RdbD18aieNUG9fl+T+Pym5oFcikBLe08a38iUi9GQ804z1BKrz2O1LsA0hnR/ORpvZim3X/LkjzsZ6VkglelBReZLxpROMKsxcfdyc0ZFNgiMKrQTeh8fazC3+ZOPdni9G9WlcPD5hO8mmdxGQHY9licFHr3zoATYMfcq1jquAEGUnfr0SsAiMxq6ut+QwhENux4AFezI2jE8qXhKmhkKxGpQucSKVi1QmDcKeRULwCh8TNrP32HmD8mndAl962W9TibosvRDeX8Y2ne9U5GLyvXySfPpvEgByYC6IOKuYzzzmn+XWxMxoxjTtK2OLnkvt1zKUaq1PiPS6OYregxvAdKKPBUBz5ObmLibXImG3gLMf+vfDVmTDKLYmB1s9SiKrpxO0vjrRYWu0DdOWBP4wkhHDv9PPiqXI0nNpfIJm2pWy/SF0X0xgM3hX7y8eUeACzwXJkQt7XtqFEvl71HX726vXejc9bSr4imT2WUqHvmm2n9u
" Blocked="1" />
|
||||
<License Date="2014-12-19" CustomerName="Marcos Felipe Campelo" CustomerEmail="sac@webbrasild.com.br" SerialNumber="kq4d0tVmKw9pjtzb2PrbR7vB5Z5Vvu/Dl/UfZJzND+SpGRcpzO3lRvbYhflk/b0WsEtwUqyx8wFph+lGI22bvahhS0PcJD9KTJH9wsniJs9fIIr3q/B+gYUkrJ9OkFl8y7+Y2Wr0ORTNvgYCPuh0uIY8ElD/Bt9lD7cVDuBHXh/hzCeOlcugbuBp2L+hYcB25qPRgB7c34i0A/3K3P1C9uutv46L/apMl3UeJ8R810ZtnM1/TwhMQ0MaAkiod9Y/oxS9QHG4XX/7SutMSlgWHN9UMRyabQIn+oWCtfq6QamZyhvdzj6SbXeg7hwiazD7h4D/pzHrXHYXbsDnmHvUpS5s5HOmBF8zxc8DNNTy747b5fNZ5nOGt1K67r6O9auQMLAqdIlkArmHWsvE8LqqQX9yXM6WELzYm5PZn8XYD/sbEj3Y8izUzdZepAzreIlOg/I5uWszDn4CLmpBK2Dsf1ZfemqtV62GQPyKYhSQiZlWLuW0ytbQgJjCKVkOuruN" Blocked="1" />
|
||||
<License Date="2015-02-03" CustomerName="mingxu zhu" CustomerEmail="48479@qq.com" SerialNumber="kWuTAHN+t2Hgx/sdo859OXp+fvGxV0KqTb2fL3V1+bv8AjWNdtOGSAOLV6T0bF3Juq3C5ufeJHjQHPkFb1pKT08ZTvVhtWh9LKNbVaEUWMS3vzjPxFu42JawhzABCgKBFKGrczgBSES96sW2w74Inpdhjm9rlvJlkg0oJYVEc2NT1c2RyWOZg3uNq3u6d0Q/OFWr6zwpcrqPdwaycMer0q8QhNWqIKgGEd7JKEWnPCObLeYosp1w867ITOm+d3oXDsHyoj+rMr3PCMikPaCxzVUHyzsZdn1k8zZ0c1H85IxsiCvXfNYnjkhlhMK5GxoDR+qh/XXq0VvW6CMI4zAStTtSSetu1O4gS3Elrb4kZ6b6CzHRsWqCsQw90+NuLCTVlX1/z2WQcyho4PLFYlxkc7wLov26CXXmiZq4lEpBHdnLlEO7KEMwHmPhL4d0sFIubV2fNC9W/VPemGn7seR6f1wIQtxFDXabU7t73LCJZhK2OMzBqsiOgq13f9iTsdgp" Blocked="1" />
|
||||
</LicenseManager>
|
||||
<Script xml:space="preserve">
|
||||
<![CDATA[function CommandByReference(func, address)
|
||||
for i = 1, func:count() do
|
||||
local command = func:item(i)
|
||||
if (command:type() == IntelCommandType.Mov or command:type() == IntelCommandType.Lea) then
|
||||
local first_operand = command:operand(1)
|
||||
local second_operand = command:operand(2)
|
||||
if (first_operand:type() == OperandType.Registr and second_operand:type() == OperandType.Memory + OperandType.Value) then
|
||||
if (second_operand:value() == address) then
|
||||
return command
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function OnBeforeCompilation()
|
||||
local file = vmprotect.core():inputArchitecture()
|
||||
local map_functions = file:mapFunctions()
|
||||
local functions = vmprotect.core():outputArchitecture():functions()
|
||||
local watermarks = vmprotect.core():watermarks()
|
||||
|
||||
local version_watermark = nil
|
||||
local owner_watermark = nil
|
||||
local add_watermark = nil
|
||||
local serial_number = nil
|
||||
local format = file:file():format()
|
||||
if (format == "PE") then
|
||||
version_watermark = map_functions:itemByName("unsigned char * version_watermark")
|
||||
owner_watermark = map_functions:itemByName("unsigned char * owner_watermark")
|
||||
add_watermark = functions:itemByName("BaseFunction::AddWatermark(class Watermark *,int)")
|
||||
serial_number = functions:itemByName("string \"SerialNumber\"")
|
||||
elseif (format == "ELF") then
|
||||
version_watermark = map_functions:itemByName("version_watermark")
|
||||
owner_watermark = map_functions:itemByName("owner_watermark")
|
||||
add_watermark = functions:itemByName("BaseFunction::AddWatermark(Watermark*, int)")
|
||||
serial_number = functions:itemByName("string \"SerialNumber\"")
|
||||
else
|
||||
version_watermark = map_functions:itemByName("_version_watermark")
|
||||
owner_watermark = map_functions:itemByName("_owner_watermark")
|
||||
add_watermark = functions:itemByName("BaseFunction::AddWatermark(Watermark*, int)")
|
||||
serial_number = functions:itemByName("string \"SerialNumber\"")
|
||||
end
|
||||
|
||||
if not version_watermark then
|
||||
error("version_watermark not found")
|
||||
end
|
||||
if not owner_watermark then
|
||||
error("owner_watermark not found")
|
||||
end
|
||||
if not add_watermark then
|
||||
error("add_watermark not found")
|
||||
end
|
||||
|
||||
-- add watermarks
|
||||
local version_watermark_command = CommandByReference(add_watermark, version_watermark:address())
|
||||
local owner_watermark_command = CommandByReference(add_watermark, owner_watermark:address())
|
||||
if not version_watermark_command then
|
||||
error("version_watermark_command not found")
|
||||
end
|
||||
-- 2223 - Testing Purposes and Demo watermark Customer ID
|
||||
local watermark = watermarks:itemByName("2223")
|
||||
if (watermark) then
|
||||
add_watermark:xproc(version_watermark_command:address(), watermark:value())
|
||||
else
|
||||
error("Testing Purposes and Demo watermark was not found in the database");
|
||||
end
|
||||
if not owner_watermark_command then
|
||||
error("owner_watermark_command not found")
|
||||
end
|
||||
watermark = watermarks:itemByName(vmprotect.core():watermarkName())
|
||||
if watermark then
|
||||
add_watermark:xproc(owner_watermark_command:address(), watermark:value())
|
||||
end
|
||||
|
||||
-- add key
|
||||
if serial_number then
|
||||
if not key then
|
||||
error("key file not found")
|
||||
end
|
||||
serial_number:item(1):setDump(key .. string.char(0))
|
||||
end
|
||||
end
|
||||
|
||||
function AddFunction(name)
|
||||
local file = vmprotect.core():inputFile():item(1)
|
||||
local map_function = file:mapFunctions():itemByName(name)
|
||||
if (map_function) then
|
||||
file:functions():addByAddress(map_function:address())
|
||||
end
|
||||
end
|
||||
|
||||
-- parse key file
|
||||
local key_found = false
|
||||
key = nil
|
||||
local prid_found = false
|
||||
local built_product_id = -1
|
||||
local command_line = vmprotect.commandLine()
|
||||
for _, arg in ipairs(command_line) do
|
||||
if (key_found == true) and (not key) then
|
||||
local stream = io.open(arg, "r")
|
||||
if not stream then
|
||||
error("key file not found")
|
||||
end
|
||||
key = stream:read("*all")
|
||||
stream:close()
|
||||
end
|
||||
if (arg == "-key") then
|
||||
key_found = true
|
||||
end
|
||||
if (prid_found == true) then
|
||||
built_product_id = tonumber(arg)
|
||||
end
|
||||
if (arg == "-product") then
|
||||
prid_found = true
|
||||
end
|
||||
if (arg == "-f") then
|
||||
local watermark_name = vmprotect.core():watermarkName()
|
||||
if (watermark_name ~= "" and not vmprotect.core():watermarks():itemByName(watermark_name)) then
|
||||
vmprotect.core():watermarks():add(watermark_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
if key then
|
||||
print("----------- Key ------------")
|
||||
local licenses = vmprotect.core():licenses()
|
||||
local license = licenses:itemBySerialNumber(key)
|
||||
if not license then
|
||||
license = licenses:importLicense(key)
|
||||
end
|
||||
if not license then
|
||||
error("Status: Invalid")
|
||||
end
|
||||
|
||||
local info = license:info()
|
||||
if not info then
|
||||
error("Status: Invalid")
|
||||
end
|
||||
print("Customer Name: ", info:customerName())
|
||||
print("Customer Email: ", info:customerEmail())
|
||||
if license:blocked() then
|
||||
error("Status: Blocked")
|
||||
end
|
||||
if bit32.btest(info:flags(), 4) then
|
||||
local dt = info:expireDate("%Y%m%d")
|
||||
print("Expire Date: ", dt)
|
||||
if os.date("%Y%m%d") > dt then
|
||||
error("Status: Expired")
|
||||
end
|
||||
end
|
||||
if bit32.btest(info:flags(), 8) then
|
||||
local max_build_date = info:maxBuildDate("%Y%m%d")
|
||||
print("Max Build Date: ", max_build_date)
|
||||
if os.date("%Y%m%d") > max_build_date then
|
||||
error("Status: Expired")
|
||||
end
|
||||
end
|
||||
local product_id = -1
|
||||
if bit32.btest(info:flags(), 64) then
|
||||
local user_data = info:userData()
|
||||
if user_data:len() >= 1 then
|
||||
product_id = user_data:byte(1)
|
||||
end
|
||||
end
|
||||
print("Product ID: ", product_id)
|
||||
if (built_product_id ~= -1) and (product_id ~= -1) then
|
||||
if (product_id ~= built_product_id) then
|
||||
error("Status: Wrong Product ID")
|
||||
end
|
||||
end
|
||||
print("Status:", "Success")
|
||||
print("----------------------------")
|
||||
end
|
||||
|
||||
if vmprotect.core():inputFile() then
|
||||
local format = vmprotect.core():inputFile():format()
|
||||
if (format == "PE") then
|
||||
-- x32
|
||||
AddFunction("_WinMainCRTStartup")
|
||||
AddFunction("_WinMain@16")
|
||||
AddFunction("_wmainCRTStartup")
|
||||
AddFunction("_wmain")
|
||||
AddFunction("___security_init_cookie")
|
||||
-- x64
|
||||
AddFunction("WinMainCRTStartup")
|
||||
AddFunction("WinMain")
|
||||
AddFunction("wmainCRTStartup")
|
||||
AddFunction("wmain")
|
||||
AddFunction("__security_init_cookie")
|
||||
--
|
||||
AddFunction("__scrt_common_main_seh(void)")
|
||||
AddFunction("ConsoleApplication::Run(void)")
|
||||
AddFunction("Core::Compile(void)")
|
||||
AddFunction("BaseFunction::AddWatermark(class Watermark *,int)")
|
||||
AddFunction("IntelFunction::AddWatermarkReference(unsigned __int64,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)")
|
||||
AddFunction("BaseArchitecture::Compile(struct CompileOptions &,class IArchitecture *)")
|
||||
AddFunction("AboutDialog::AboutDialog(class QWidget *)");
|
||||
AddFunction("AboutDialog::purchaseLicense(void)")
|
||||
elseif (format == "ELF") then
|
||||
AddFunction("main")
|
||||
AddFunction("ConsoleApplication::Run()")
|
||||
AddFunction("Core::check_license_edition(VMProtectSerialNumberData const&)")
|
||||
AddFunction("Core::Compile()")
|
||||
AddFunction("BaseFunction::AddWatermark(Watermark*, int)")
|
||||
AddFunction("IntelFunction::AddWatermarkReference(unsigned long, std::string const&)")
|
||||
AddFunction("BaseArchitecture::Compile(CompileOptions&, IArchitecture*)")
|
||||
AddFunction("AboutDialog::AboutDialog(QWidget*)");
|
||||
AddFunction("AboutDialog::purchaseLicense()")
|
||||
else
|
||||
AddFunction("_main")
|
||||
AddFunction("ConsoleApplication::Run()")
|
||||
AddFunction("Core::check_license_edition(VMProtectSerialNumberData const&)")
|
||||
AddFunction("Core::Compile()")
|
||||
AddFunction("BaseFunction::AddWatermark(Watermark*, int)")
|
||||
AddFunction("IntelFunction::AddWatermarkReference(unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)")
|
||||
AddFunction("BaseArchitecture::Compile(CompileOptions&, IArchitecture*)")
|
||||
AddFunction("AboutDialog::AboutDialog(QWidget*)");
|
||||
AddFunction("AboutDialog::purchaseLicense()")
|
||||
end
|
||||
end]]>
|
||||
</Script>
|
||||
</Document>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user