-
Notifications
You must be signed in to change notification settings - Fork 0
Image COM Descriptor CLI Directory
AFP edited this page Apr 1, 2023
·
1 revision
after initialize the PE class you can get access the Image Com/CLI Directory structure by calling GetImageComDescriptor() method. by calling this function, you get the object of ImageComDescriptor class, so you can retrieve the fields, change or modify them.
#include <iostream>
#include <POEX.h> // include POEX header
int main()
{
auto pe = POEX::PE(L"1.exe");
// Access to Image Com Directory
auto comDirectory = pe.GetImageComDescriptor();
// other stuff in here
return 0;
}With calling GetImageComDescriptor method, you can access the structure and method in bellow:
/// <summary>
/// Resolve flags from the ImageCor20Header COM+ 2 (CLI) header to their string representation.
/// </summary>
/// <param name="comFlags">Flags from ImageCor20Header.</param>
/// <returns>List with resolved flag names.</returns>
static auto ResolveComFlags(const ComFlagsType& comFlags) -> std::vector<std::string>;
/// <summary>
/// Size of the structure.
/// </summary>
/// <returns>The structure Length</returns>
auto Cb() const -> unsigned int;
/// <summary>
/// Size of the structure.
/// </summary>
/// <param name="size">The structure Length</param>
/// <returns></returns>
auto Cb(const unsigned int& size) -> void;
/// <summary>
/// Major runtime version of the CRL.
/// </summary>
/// <returns>Major version</returns>
auto MajorRuntimeVersion() const -> unsigned short;
/// <summary>
/// Major runtime version of the CRL.
/// </summary>
/// <param name="version">Major version</param>
/// <returns></returns>
auto MajorRuntimeVersion(const unsigned short& version) -> void;
/// <summary>
/// Minor runtime version of the CRL.
/// </summary>
/// <returns>Minor version</returns>
auto MinorRuntimeVersion() const -> unsigned short;
/// <summary>
/// Minor runtime version of the CRL.
/// </summary>
/// <param name="version">Minor version</param>
/// <returns></returns>
auto MinorRuntimeVersion(const unsigned short& version) -> void;
/// <summary>
/// Meta data directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto MetaData() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// COM image flags.
/// </summary>
/// <returns>ComFlagsType enum</returns>
auto Flags() const -> ComFlagsType;
/// <summary>
/// Readable list of COM flags.
/// </summary>
/// <returns>List of flags string</returns>
auto FlagsResolved() const -> std::vector<std::string>;
/// <summary>
/// Represents the managed entry point if NativeEntrypoint is not set. Union with EntryPointRVA.
/// </summary>
/// <returns>Entry point token</returns>
auto EntryPointToken() const -> unsigned int;
/// <summary>
/// Represents the managed entry point if NativeEntrypoint is not set. Union with EntryPointRVA.
/// </summary>
/// <param name="entryPoint">Entry point token</param>
/// <returns></returns>
auto EntryPointToken(const unsigned int& entryPoint) -> void;
/// <summary>
/// Represents an RVA to an native entry point if the NativeEntrypoint is set. Union with EntryPointToken.
/// </summary>
/// <returns>Entry point rva</returns>
auto EntryPointRva() const -> unsigned int;
/// <summary>
/// Represents an RVA to an native entry point if the NativeEntrypoint is set. Union with EntryPointToken.
/// </summary>
/// <param name="entryPoint">Entry point rva</param>
/// <returns></returns>
auto EntryPointRva(const unsigned int& entryPoint) -> void;
/// <summary>
/// Resource data directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto Resources() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// Strong names signature directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto StrongNameSignature() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// Code manager table directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto CodeManagerTable() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// Virtual table fix up directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto VTableFixups() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// Export address table jump directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto ExportAddressTableJumps() -> std::shared_ptr<ImageDataDirectory>;
/// <summary>
/// Managed native header directory.
/// </summary>
/// <returns>Pointer of ImageDataDirectory object</returns>
auto ManagedNativeHeader() -> std::shared_ptr<ImageDataDirectory>;