Package ghidra.app.util.bin.format.pe.resource

# 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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `SIZEOF`

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourceDirectoryEntry(BinaryReader reader, int index, int resourceBase, boolean isNameEntry, boolean isFirstLevel, NTHeader ntHeader)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ResourceDataEntry`
  `getData()`
  `boolean`
  `getDataIsDirectory()`
  Returns a pointer to information about a specific resource instance.
  `ResourceDirectoryStringU`
  `getDirectoryString()`
  `int`
  `getId()`
  Returns a resource ID.
  `int`
  `getName()`
  `boolean`
  `getNameIsString()`
  Returns the ID of the name of this resource.
  `int`
  `getNameOffset()`
  Returns the offset to the name of this resource.
  `int`
  `getOffsetToData()`
  `int`
  `getOffsetToDirectory()`
  Returns an offset to another resource directory.
  `List<ResourceInfo>`
  `getResources(int level)`
  `ResourceDirectory`
  `getSubDirectory()`
  `boolean`
  `isNameEntry()`
  Returns true if the parent resource directory is named, false indicates an ID.
  `boolean`
  `isValid()`
  `DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### SIZEOF

    public static final int SIZEOF
    See Also:
      - Constant Field Values

- ## 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:
      - `getName()`

  - ### 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()`

  - ### 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:
      - `getName()`

  - ### 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:
      - `getOffsetToData()`

  - ### 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:
      - `getOffsetToData()`

  - ### 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`
    See Also:
      - `StructureDataType`

  - ### isValid

    public boolean isValid()