#pragma once #include "../Config.h" #ifdef COMPILER_MSVC #include "../Include/Winheaders.h" #include #if _MSC_VER >= 1920 #include #endif #pragma warning(push) #pragma warning(disable : 4091) #include "cor.h" #include #pragma warning(pop) namespace blackbone { /// /// .NET metadata parser /// class ImageNET { public: using mapMethodRVA = std::map, uintptr_t>; public: BLACKBONE_API ImageNET(void); BLACKBONE_API ~ImageNET(void); /// /// Initialize COM classes /// /// Image file path /// true on success BLACKBONE_API bool Init( const std::wstring& path ); /// /// Extract methods from image /// /// Found Methods /// true on success BLACKBONE_API bool Parse( mapMethodRVA* methods = nullptr ); /// /// Get image .NET runtime version /// /// runtime version, "n/a" if nothing found BLACKBONE_API static std::wstring GetImageRuntimeVer( const wchar_t* ImagePath ); private: std::wstring _path; // Image path mapMethodRVA _methods; // Image methods // COM helpers CComPtr _pMetaDisp; CComPtr _pMetaImport; CComPtr _pAssemblyImport; }; } #endif