Crashpad

Public Member Functions | List of all members
crashpad::PEImageResourceReader Class Reference

A reader for resources stored in PE images mapped into another process. More...

`#include "snapshot/win/pe_image_resource_reader.h"`

## Public Member Functions
bool | Initialize (const ProcessSubrangeReader &module_subrange_reader, const IMAGE_DATA_DIRECTORY &resources_directory_entry)
| Initializes the resource reader. More...
bool | FindResourceByID (uint16_t type, uint16_t name, uint16_t language, WinVMAddress *address, WinVMSize *size, uint32_t *code_page) const
| Locates a resource in a module by its ID. More...

## Detailed Description

A reader for resources stored in PE images mapped into another process.

See also
  PEImageReader

## Member Function Documentation

## ◆ FindResourceByID()

bool crashpad::PEImageResourceReader::FindResourceByID | ( | uint16_t | type,
|  | uint16_t | name,
|  | uint16_t | language,
|  | WinVMAddress * | address,
|  | WinVMSize * | size,
|  | uint32_t * | code_page
| ) |  | const

Locates a resource in a module by its ID.

This method is similar to `FindResourceEx()`, but it operates on modules loaded in a remote process’ address space. It is not necessary to `LoadLibrary()` a module into a process in order to use this method.

No support is provided at present for locating resources by type or name using strings as opposed to integer identifiers.

Languages are scanned in the order determined by GetEntryFromResourceDirectoryByLanguage().

Parameters

  [in] | type | The integer identifier of the resource type, as in the `lpType` parameter of `FindResourceEx()`.
  [in] | name | The integer identifier of the resource, as in the `lpName` parameter of `FindResourceEx()`.
  [in] | language | The language of the resource, as in the `wLanguage` parameter of `FindResourceEx()`.
  [out] | address | The address, in the remote process’ address space, of the resource data.
  [out] | size | The size of the resource data.
  [out] | code_page | The code page used to encode textual resource data. This parameter is optional.

Returns
  `true` on success, with the out parameters set appropriately. `false` if the resource was not found, without logging any messages. `false` on failure, with a message logged.

## ◆ Initialize()

bool crashpad::PEImageResourceReader::Initialize | ( | const ProcessSubrangeReader & | module_subrange_reader,
|  | const IMAGE_DATA_DIRECTORY & | resources_directory_entry
| ) |  |

Initializes the resource reader.

Parameters

  [in] | module_subrange_reader | The reader for the module.
  [in] | resources_directory_entry | The module’s `IMAGE_DATA_DIRECTORY` for its resources area. This is taken from the module’s `IMAGE_OPTIONAL_HEADER::DataDirectory` at index `IMAGE_DIRECTORY_ENTRY_RESOURCE`.

Returns
  `true` on success, `false` on failure with a message logged.

The documentation for this class was generated from the following files:

- snapshot/win/pe_image_resource_reader.h
- snapshot/win/pe_image_resource_reader.cc