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

# Class ResourceDataDirectory

java.lang.Object
ghidra.app.util.bin.format.pe.DataDirectory
ghidra.app.util.bin.format.pe.ResourceDataDirectory

All Implemented Interfaces:
  `PeMarkupable`

public class ResourceDataDirectory extends DataDirectory
Points to the root resource directory.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static Set<Integer>`
  `directoryMap`
  `static final int`
  `IMAGE_RESOURCE_DATA_IS_DIRECTORY`
  A flag indicating that a resources is a directory.
  `static final int`
  `IMAGE_RESOURCE_NAME_IS_STRING`
  A flag indicating that a resources is a string.
  `static final int`
  `IMAGE_SIZEOF_RESOURCE_DIRECTORY`
  The size of a resource directory, in bytes.
  `static final int`
  `IMAGE_SIZEOF_RESOURCE_DIRECTORY_ENTRY`
  The size of a resource directory entry, in bytes.
  `static final String[]`
  `PREDEFINED_RESOURCE_NAMES`
  A lookup table to obtain a string name for a resource type.
  `static final byte`
  `RT_ACCELERATOR`
  Accelerator table.
  `static final byte`
  `RT_ANICURSOR`
  Animated cursor resource.
  `static final byte`
  `RT_ANIICON`
  Animated icon resource.
  `static final byte`
  `RT_BITMAP`
  Bitmap resource.
  `static final byte`
  `RT_CURSOR`
  /** Hardware-dependent cursor resource.
  `static final byte`
  `RT_DIALOG`
  Dialog box.
  `static final byte`
  `RT_DLGINCLUDE`
  `static final byte`
  `RT_FONT`
  Font resource.
  `static final byte`
  `RT_FONTDIR`
  Font directory resource.
  `static final byte`
  `RT_GROUP_CURSOR`
  Hardware-independent cursor resource.
  `static final byte`
  `RT_GROUP_ICON`
  Hardware-independent icon resource.
  `static final byte`
  `RT_HTML`
  HTML resource.
  `static final byte`
  `RT_ICON`
  Hardware-dependent icon resource.
  `static final byte`
  `RT_MANIFEST`
  Manifest resource
  `static final byte`
  `RT_MENU`
  Menu resource.
  `static final byte`
  `RT_MESSAGETABLE`
  Message-table entry.
  `static final byte`
  `RT_NOTDEFINED`
  Not defined in documentation but PNGs and WAVs are both this type
  `static final byte`
  `RT_PLUGPLAY`
  Plug and Play resource.
  `static final byte`
  `RT_RCDATA`
  Application-defined resource (raw data).
  `static final byte`
  `RT_STRING`
  String-table entry.
  `static final byte`
  `RT_VERSION`
  Version resource.
  `static final byte`
  `RT_VXD`
  VXD resource.

  ### Fields inherited from class ghidra.app.util.bin.format.pe.DataDirectory

  `hasParsed, IMAGE_SIZEOF_IMAGE_DIRECTORY_ENTRY, ntHeader, reader, size, TITLE, virtualAddress`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getDirectoryName()`
  `static String`
  `getPeResourceProperty(String key)`
  Gets a program property name to represent PE resource property with the given key name
  `List<ResourceInfo>`
  `getResources()`
  `ResourceDirectory`
  `getRootDirectory()`
  `void`
  `markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader nt)`
  Marks up a PE structure.
  `boolean`
  `parse()`
  Parses this data directory.
  `String`
  `toString()`

  ### Methods inherited from class ghidra.app.util.bin.format.pe.DataDirectory

  `createDirectoryBookmark, createFragment, createTerminatedString, getPointer, getSize, getVirtualAddress, hasParsedCorrectly, processDataDirectory, setBookmark, setEolComment, setPlateComment, setPreComment, setSize, setVirtualAddress, va, validateSize, writeBytes`

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

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

- ## Field Details

  - ### IMAGE_SIZEOF_RESOURCE_DIRECTORY_ENTRY

    public static final int IMAGE_SIZEOF_RESOURCE_DIRECTORY_ENTRY
    The size of a resource directory entry, in bytes.
    See Also:
      - Constant Field Values

  - ### IMAGE_SIZEOF_RESOURCE_DIRECTORY

    public static final int IMAGE_SIZEOF_RESOURCE_DIRECTORY
    The size of a resource directory, in bytes.
    See Also:
      - Constant Field Values

  - ### IMAGE_RESOURCE_NAME_IS_STRING

    public static final int IMAGE_RESOURCE_NAME_IS_STRING
    A flag indicating that a resources is a string.
    See Also:
      - Constant Field Values

  - ### IMAGE_RESOURCE_DATA_IS_DIRECTORY

    public static final int IMAGE_RESOURCE_DATA_IS_DIRECTORY
    A flag indicating that a resources is a directory.
    See Also:
      - Constant Field Values

  - ### PREDEFINED_RESOURCE_NAMES

    public static final String[] PREDEFINED_RESOURCE_NAMES
    A lookup table to obtain a string name for a resource type.

  - ### RT_NOTDEFINED

    public static final byte RT_NOTDEFINED
    Not defined in documentation but PNGs and WAVs are both this type
    See Also:
      - Constant Field Values

  - ### RT_CURSOR

    public static final byte RT_CURSOR
    /** Hardware-dependent cursor resource.
    See Also:
      - Constant Field Values

  - ### RT_BITMAP

    public static final byte RT_BITMAP
    Bitmap resource.
    See Also:
      - Constant Field Values

  - ### RT_ICON

    public static final byte RT_ICON
    Hardware-dependent icon resource.
    See Also:
      - Constant Field Values

  - ### RT_MENU

    public static final byte RT_MENU
    Menu resource.
    See Also:
      - Constant Field Values

  - ### RT_DIALOG

    public static final byte RT_DIALOG
    Dialog box.
    See Also:
      - Constant Field Values

  - ### RT_STRING

    public static final byte RT_STRING
    String-table entry.
    See Also:
      - Constant Field Values

  - ### RT_FONTDIR

    public static final byte RT_FONTDIR
    Font directory resource.
    See Also:
      - Constant Field Values

  - ### RT_FONT

    public static final byte RT_FONT
    Font resource.
    See Also:
      - Constant Field Values

  - ### RT_ACCELERATOR

    public static final byte RT_ACCELERATOR
    Accelerator table.
    See Also:
      - Constant Field Values

  - ### RT_RCDATA

    public static final byte RT_RCDATA
    Application-defined resource (raw data).
    See Also:
      - Constant Field Values

  - ### RT_MESSAGETABLE

    public static final byte RT_MESSAGETABLE
    Message-table entry.
    See Also:
      - Constant Field Values

  - ### RT_GROUP_CURSOR

    public static final byte RT_GROUP_CURSOR
    Hardware-independent cursor resource.
    See Also:
      - Constant Field Values

  - ### RT_GROUP_ICON

    public static final byte RT_GROUP_ICON
    Hardware-independent icon resource.
    See Also:
      - Constant Field Values

  - ### RT_VERSION

    public static final byte RT_VERSION
    Version resource.
    See Also:
      - Constant Field Values

  - ### RT_DLGINCLUDE

    public static final byte RT_DLGINCLUDE
    See Also:
      - Constant Field Values

  - ### RT_PLUGPLAY

    public static final byte RT_PLUGPLAY
    Plug and Play resource.
    See Also:
      - Constant Field Values

  - ### RT_VXD

    public static final byte RT_VXD
    VXD resource.
    See Also:
      - Constant Field Values

  - ### RT_ANICURSOR

    public static final byte RT_ANICURSOR
    Animated cursor resource.
    See Also:
      - Constant Field Values

  - ### RT_ANIICON

    public static final byte RT_ANIICON
    Animated icon resource.
    See Also:
      - Constant Field Values

  - ### RT_HTML

    public static final byte RT_HTML
    HTML resource.
    See Also:
      - Constant Field Values

  - ### RT_MANIFEST

    public static final byte RT_MANIFEST
    Manifest resource
    See Also:
      - Constant Field Values

  - ### directoryMap

    public static Set<Integer> directoryMap

- ## Method Details

  - ### getPeResourceProperty

    public static String getPeResourceProperty(String key)
    Gets a program property name to represent PE resource property with the given key name
    Parameters:
      `key` - The key name
    Returns:
      A program property name to represent PE resource property with the given key name

  - ### getRootDirectory

    public ResourceDirectory getRootDirectory()

  - ### getDirectoryName

    public String getDirectoryName()
    Specified by:
      `getDirectoryName` in class `DataDirectory`

  - ### markup

    public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader nt) throws DuplicateNameException, CodeUnitInsertionException, IOException
    Description copied from interface: `PeMarkupable`
    Marks up a PE structure.
    Parameters:
      `program` - The program to markup.
      `isBinary` - True if the program is binary; otherwise, false.
      `monitor` - The monitor.
      `log` - The log.
      `nt` - The PE's NT Header structure.
    Throws:
      `DuplicateNameException`
      `CodeUnitInsertionException`
      `IOException`

  - ### parse

    public boolean parse() throws IOException
    Description copied from class: `DataDirectory`
    Parses this data directory.
    Specified by:
      `parse` in class `DataDirectory`
    Returns:
      True if parsing completed successfully; otherwise, false.
    Throws:
      `IOException` - If there was an IO problem while parsing.

  - ### getResources

    public List<ResourceInfo> getResources()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `DataDirectory`
    See Also:
      - `Object.toString()`