Class ResourceDirectoryEntry

java.lang.Object
ghidra.app.util.bin.format.pe.resource.ResourceDirectoryEntry
All Implemented Interfaces:
StructConverter

public class ResourceDirectoryEntry extends Object implements StructConverter
 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
     union {
         struct {
             DWORD NameOffset:31;
             DWORD NameIsString:1;
         };
         DWORD   Name;
         WORD    Id;
     };
     union {
         DWORD   OffsetToData;
         struct {
             DWORD   OffsetToDirectory:31;
             DWORD   DataIsDirectory:1;
         };
     };
 };
 
  • Field Details

  • Constructor Details

    • ResourceDirectoryEntry

      public ResourceDirectoryEntry(BinaryReader reader, int index, int resourceBase, boolean isNameEntry, boolean isFirstLevel, NTHeader ntHeader) throws IOException
      Constructor.
      Parameters:
      reader - the binary reader
      index - the index where this directory begins
      Throws:
      IOException
  • Method Details

    • getResources

      public List<ResourceInfo> getResources(int level)
    • isNameEntry

      public boolean isNameEntry()
      Returns true if the parent resource directory is named, false indicates an ID.
    • getDirectoryString

      public ResourceDirectoryStringU getDirectoryString()
    • getData

      public ResourceDataEntry getData()
    • getSubDirectory

      public ResourceDirectory getSubDirectory()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNameOffset

      public int getNameOffset()
      Returns the offset to the name of this resource.
      Returns:
      the offset to the name of this resource
      See Also:
    • getNameIsString

      public boolean getNameIsString()
      Returns the ID of the name of this resource.
      Returns:
      the ID of the name of this resource
      See Also:
    • getName

      public int getName()
      Returns:
      either an integer ID or a pointer to a structure that contains a string name
    • getId

      public int getId()
      Returns a resource ID.
      Returns:
      a resource ID
      See Also:
    • getOffsetToData

      public int getOffsetToData()
      Returns:
      either an offset to another resource directory or a pointer to information about a specific resource instance
    • getOffsetToDirectory

      public int getOffsetToDirectory()
      Returns an offset to another resource directory.
      Returns:
      an offset to another resource directory
      See Also:
    • getDataIsDirectory

      public boolean getDataIsDirectory()
      Returns a pointer to information about a specific resource instance.
      Returns:
      a pointer to information about a specific resource instance
      See Also:
    • toDataType

      public DataType toDataType() throws DuplicateNameException, IOException
      Description copied from interface: StructConverter
      Returns a structure datatype representing the contents of the implementor of this interface.

      For example, given:

       class A {
           int foo;
           double bar;
       }
       

      The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.

      Specified by:
      toDataType in interface StructConverter
      Returns:
      returns a structure datatype representing the implementor of this interface
      Throws:
      DuplicateNameException - when a datatype of the same name already exists
      IOException - if an IO-related error occurs
      See Also:
    • isValid

      public boolean isValid()