OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (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 | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | |
16 #define CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | |
17 | |
18 #include <windows.h> | |
19 | |
20 #include <string> | |
21 | |
22 #include "base/basictypes.h" | |
23 #include "base/memory/scoped_ptr.h" | |
Mark Mentovai
2015/04/29 19:37:15
Unused
scottmg
2015/04/30 03:31:32
Done.
| |
24 #include "util/misc/initialization_state_dcheck.h" | |
25 #include "util/misc/uuid.h" | |
Mark Mentovai
2015/04/29 19:37:15
Unused (for now)
scottmg
2015/04/30 03:31:32
Done.
| |
26 #include "util/stdlib/pointer_container.h" | |
Mark Mentovai
2015/04/29 19:37:15
Unused
scottmg
2015/04/30 03:31:32
Done.
| |
27 | |
28 namespace crashpad { | |
29 | |
30 class ProcessReaderWin; | |
31 | |
32 namespace process_types { | |
33 | |
34 // TODO(scottmg): Genericize and/or? move process_types out of mac/. | |
35 struct CrashpadInfo { | |
36 uint32_t signature; | |
37 uint32_t size; | |
38 uint32_t version; | |
39 uint8_t crashpad_handler_behavior; // TriState. | |
40 uint8_t system_crash_reporter_forwarding; // TriState. | |
41 uint16_t padding_0; | |
42 uint64_t simple_annotations; // TODO(scottmg): x86/64. | |
43 }; | |
44 | |
45 struct Section { | |
46 }; | |
47 | |
48 } // namespace process_types | |
49 | |
50 //! \brief A reader for PE images mapped into another process. | |
51 //! | |
52 //! This class is capable of reading both 32-bit and 64-bit images based on the | |
53 //! bitness of the remote process. | |
54 //! | |
55 //! \sa PEImageAnnotationsReader | |
56 class PEImageReader { | |
57 public: | |
58 PEImageReader(); | |
59 ~PEImageReader(); | |
60 | |
61 //! \brief Initializes the reader. | |
62 //! | |
63 //! This method must be called only once on an object. This method must be | |
64 //! called successfully before any other method in this class may be called. | |
65 //! | |
66 //! \param[in] process_reader The reader for the remote process. | |
67 //! \param[in] address The address, in the remote process' address space, | |
68 //! where the `IMAGE_DOS_HEADER` is located. | |
69 //! \param[in] name The module's name, a string to be used in logged messages. | |
70 //! This string is for diagnostic purposes. | |
71 //! | |
72 //! \return `true` if the image was read successfully, including all load | |
Mark Mentovai
2015/04/29 19:37:15
Load commands are a Mach-O thing. You can say what
scottmg
2015/04/30 03:31:32
Oops, missed that one. Done.
| |
73 //! commands. `false` otherwise, with an appropriate message logged. | |
74 bool Initialize(ProcessReaderWin* process_reader, | |
75 uintptr_t address, | |
76 const std::string& name); | |
Mark Mentovai
2015/04/29 19:37:15
The member variable is module_name_ and it’s total
scottmg
2015/04/30 03:31:32
Done.
| |
77 | |
78 //! \brief Obtains the module's CrashpadInfo structure. | |
79 //! | |
80 //! \return `true` on success, `false` on failure. If the module does not have | |
81 //! a `CPADinfo` section, this will return `false` without logging any | |
82 //! messages. Other failures will result in messages being logged. | |
83 bool GetCrashpadInfo(process_types::CrashpadInfo* crashpad_info) const; | |
84 | |
85 private: | |
86 //! \brief Finds a given section by name in the image. | |
87 bool GetSectionByName(const std::string& name, | |
88 IMAGE_SECTION_HEADER* section) const; | |
89 | |
90 ProcessReaderWin* process_reader_; // weak | |
91 uintptr_t address_; | |
92 std::string module_name_; | |
93 InitializationStateDcheck initialized_; | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(PEImageReader); | |
96 }; | |
97 | |
98 } // namespace crashpad | |
99 | |
100 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | |
OLD | NEW |