| Index: snapshot/win/pe_image_reader.h
|
| diff --git a/snapshot/win/pe_image_reader.h b/snapshot/win/pe_image_reader.h
|
| index f6364d99f2d08389dfad5149af3e5018f53be3ce..1b211c01180ba5b8dc778c4dc0b3f0f45671b3a7 100644
|
| --- a/snapshot/win/pe_image_reader.h
|
| +++ b/snapshot/win/pe_image_reader.h
|
| @@ -51,6 +51,7 @@ struct CrashpadInfo {
|
| //! bitness of the remote process.
|
| //!
|
| //! \sa PEImageAnnotationsReader
|
| +//! \sa PEImageResourceReader
|
| class PEImageReader {
|
| public:
|
| PEImageReader();
|
| @@ -100,25 +101,34 @@ class PEImageReader {
|
| //! \param[out] age The age field for the pdb (the number of times it's been
|
| //! relinked).
|
| //! \param[out] pdbname Name of the pdb file.
|
| - //! \return `true` on success, or `false` if the module has no debug directory
|
| - //! entry.
|
| - bool DebugDirectoryInformation(UUID* uuid,
|
| - DWORD* age,
|
| - std::string* pdbname) const;
|
| -
|
| - private:
|
| - //! \brief Implementation helper for DebugDirectoryInformation() templated by
|
| - //! `IMAGE_NT_HEADERS` type for different bitnesses.
|
| //!
|
| //! \return `true` on success, with the parameters set appropriately. `false`
|
| //! on failure. This method may return `false` without logging anything in
|
| //! the case of a module that does not contain relevant debugging
|
| //! information but is otherwise properly structured.
|
| - template <class NtHeadersType>
|
| - bool ReadDebugDirectoryInformation(UUID* uuid,
|
| - DWORD* age,
|
| - std::string* pdbname) const;
|
| + bool DebugDirectoryInformation(UUID* uuid,
|
| + DWORD* age,
|
| + std::string* pdbname) const;
|
|
|
| + //! \brief Obtains the module’s `VS_FIXEDFILEINFO`, containing its version and
|
| + //! type information.
|
| + //!
|
| + //! The data obtained from this method should be equivalent to what could be
|
| + //! obtained by calling GetModuleVersionAndType(). Avoiding that function
|
| + //! ensures that the data in the module loaded into the remote process will be
|
| + //! used as-is, without the risks associated with loading the module into the
|
| + //! reading process.
|
| + //!
|
| + //! \param[out] vs_fixed_file_info The VS_FIXEDFILEINFO on success.
|
| + //! VS_FIXEDFILEINFO::dwFileFlags will have been masked with
|
| + //! VS_FIXEDFILEINFO::dwFileFlagsMask already.
|
| + //!
|
| + //! \return `true` on success. `false` if the module does not contain this
|
| + //! information, without logging any messages. `false` on failure, with
|
| + //! a message logged.
|
| + bool VSFixedFileInfo(VS_FIXEDFILEINFO* vs_fixed_file_info) const;
|
| +
|
| + private:
|
| //! \brief Reads the `IMAGE_NT_HEADERS` from the beginning of the image.
|
| //!
|
| //! \param[out] nt_headers The contents of the templated NtHeadersType
|
| @@ -139,11 +149,29 @@ class PEImageReader {
|
| bool GetSectionByName(const std::string& name,
|
| IMAGE_SECTION_HEADER* section) const;
|
|
|
| - //! \brief Reads memory from target process, first checking whether the range
|
| - //! requested falls inside module_range_.
|
| + //! \brief Finds the `IMAGE_DATA_DIRECTORY` in
|
| + //! `IMAGE_OPTIONAL_HEADER::DataDirectory` at the specified \a index.
|
| + //!
|
| + //! \param[in] index An `IMAGE_DIRECTORY_ENTRY_*` constant specifying the
|
| + //! data to be returned.
|
| + //! \param[out] entry The `IMAGE_DATA_DIRECTORY` found within the module.
|
| + //!
|
| + //! \return `true` on success, with \a entry set appropriately. `false` if the
|
| + //! module does not contain the specified information, without logging a
|
| + //! message. `false` on failure, with a message logged.
|
| + bool ImageDataDirectoryEntry(size_t index, IMAGE_DATA_DIRECTORY* entry) const;
|
| +
|
| + //! \brief A templatized helper for ImageDataDirectoryEntry() to account for
|
| + //! differences in \a NtHeadersType.
|
| + template <class NtHeadersType>
|
| + bool ImageDataDirectoryEntryT(size_t index,
|
| + IMAGE_DATA_DIRECTORY* entry) const;
|
| +
|
| + //! \brief Reads memory from the target process, first checking whether the
|
| + //! range requested falls inside module_range_.
|
| //!
|
| - //! \return `true` on success, with \a into filled out, otherwise `false` and
|
| - //! a message will be logged.
|
| + //! \return `true` on success, with \a into filled out, otherwise `false` with
|
| + //! a message logged.
|
| bool CheckedReadMemory(WinVMAddress address,
|
| WinVMSize size,
|
| void* into) const;
|
|
|