Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: snapshot/win/pe_image_reader.h

Issue 1352323002: win: Make reading NT_IMAGE_HEADERS work cross-bitness (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@cleanup-crashpad-info
Patch Set: fixes2 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/module_snapshot_win.h ('k') | snapshot/win/pe_image_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool GetCrashpadInfo(process_types::CrashpadInfo* crashpad_info) const; 95 bool GetCrashpadInfo(process_types::CrashpadInfo* crashpad_info) const;
96 96
97 //! \brief Obtains information from the module's debug directory, if any. 97 //! \brief Obtains information from the module's debug directory, if any.
98 //! 98 //!
99 //! \param[out] uuid The unique identifier of the executable/PDB. 99 //! \param[out] uuid The unique identifier of the executable/PDB.
100 //! \param[out] age The age field for the pdb (the number of times it's been 100 //! \param[out] age The age field for the pdb (the number of times it's been
101 //! relinked). 101 //! relinked).
102 //! \param[out] pdbname Name of the pdb file. 102 //! \param[out] pdbname Name of the pdb file.
103 //! \return `true` on success, or `false` if the module has no debug directory 103 //! \return `true` on success, or `false` if the module has no debug directory
104 //! entry. 104 //! entry.
105 bool DebugDirectoryInformation(UUID* uuid, DWORD* age, std::string* pdbname); 105 bool DebugDirectoryInformation(UUID* uuid,
106 DWORD* age,
107 std::string* pdbname) const;
106 108
107 private: 109 private:
110 //! \brief Implementation helper for DebugDirectoryInformation() templated by
111 //! `IMAGE_NT_HEADERS` type for different bitnesses.
112 template <class NtHeadersType>
113 bool ReadDebugDirectoryInformation(UUID* uuid,
114 DWORD* age,
115 std::string* pdbname) const;
116
108 //! \brief Reads the `IMAGE_NT_HEADERS` from the beginning of the image. 117 //! \brief Reads the `IMAGE_NT_HEADERS` from the beginning of the image.
118 template <class NtHeadersType>
109 bool ReadNtHeaders(WinVMAddress* nt_header_address, 119 bool ReadNtHeaders(WinVMAddress* nt_header_address,
110 IMAGE_NT_HEADERS* nt_headers) const; 120 NtHeadersType* nt_headers) const;
111 121
112 //! \brief Finds a given section by name in the image. 122 //! \brief Finds a given section by name in the image.
123 template <class NtHeadersType>
113 bool GetSectionByName(const std::string& name, 124 bool GetSectionByName(const std::string& name,
114 IMAGE_SECTION_HEADER* section) const; 125 IMAGE_SECTION_HEADER* section) const;
115 126
116 //! \brief Reads memory from target process, first checking whether the range 127 //! \brief Reads memory from target process, first checking whether the range
117 //! requested falls inside module_range_. 128 //! requested falls inside module_range_.
118 //! 129 //!
119 //! \return `true` on success, with \a into filled out, otherwise `false` and 130 //! \return `true` on success, with \a into filled out, otherwise `false` and
120 //! a message will be logged. 131 //! a message will be logged.
121 bool CheckedReadMemory(WinVMAddress address, 132 bool CheckedReadMemory(WinVMAddress address,
122 WinVMSize size, 133 WinVMSize size,
123 void* into) const; 134 void* into) const;
124 135
125 ProcessReaderWin* process_reader_; // weak 136 ProcessReaderWin* process_reader_; // weak
126 CheckedWinAddressRange module_range_; 137 CheckedWinAddressRange module_range_;
127 std::string module_name_; 138 std::string module_name_;
128 InitializationStateDcheck initialized_; 139 InitializationStateDcheck initialized_;
129 140
130 DISALLOW_COPY_AND_ASSIGN(PEImageReader); 141 DISALLOW_COPY_AND_ASSIGN(PEImageReader);
131 }; 142 };
132 143
133 } // namespace crashpad 144 } // namespace crashpad
134 145
135 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ 146 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_
OLDNEW
« no previous file with comments | « snapshot/win/module_snapshot_win.h ('k') | snapshot/win/pe_image_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698