OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
25 #include "util/misc/initialization_state_dcheck.h" | 25 #include "util/misc/initialization_state_dcheck.h" |
26 | 26 |
27 namespace crashpad { | 27 namespace crashpad { |
28 | 28 |
29 //! \brief Gathers information about a process given its `HANDLE`. This consists | 29 //! \brief Gathers information about a process given its `HANDLE`. This consists |
30 //! primarily of information stored in the Process Environment Block. | 30 //! primarily of information stored in the Process Environment Block. |
31 class ProcessInfo { | 31 class ProcessInfo { |
32 public: | 32 public: |
| 33 //! \brief Contains information about a module loaded into a process. |
| 34 struct Module { |
| 35 Module(); |
| 36 ~Module(); |
| 37 |
| 38 //! \brief The pathname used to load the module from disk. |
| 39 std::wstring name; |
| 40 |
| 41 //! \brief The base address of the loaded DLL. |
| 42 uintptr_t dll_base; |
| 43 |
| 44 //! \brief The module's timestamp. |
| 45 time_t timestamp; |
| 46 }; |
| 47 |
33 ProcessInfo(); | 48 ProcessInfo(); |
34 ~ProcessInfo(); | 49 ~ProcessInfo(); |
35 | 50 |
36 //! \brief Initializes this object with information about the given | 51 //! \brief Initializes this object with information about the given |
37 //! \a process. | 52 //! \a process. |
38 //! | 53 //! |
39 //! This method must be called successfully prior to calling any other | 54 //! This method must be called successfully prior to calling any other |
40 //! method in this class. This method may only be called once. | 55 //! method in this class. This method may only be called once. |
41 //! | 56 //! |
42 //! \return `true` on success, `false` on failure with a message logged. | 57 //! \return `true` on success, `false` on failure with a message logged. |
(...skipping 14 matching lines...) Expand all Loading... |
57 | 72 |
58 //! \return The command line from the target process's Process Environment | 73 //! \return The command line from the target process's Process Environment |
59 //! Block. | 74 //! Block. |
60 bool CommandLine(std::wstring* command_line) const; | 75 bool CommandLine(std::wstring* command_line) const; |
61 | 76 |
62 //! \brief Retrieves the modules loaded into the target process. | 77 //! \brief Retrieves the modules loaded into the target process. |
63 //! | 78 //! |
64 //! The modules are enumerated in initialization order as detailed in the | 79 //! The modules are enumerated in initialization order as detailed in the |
65 //! Process Environment Block. The main executable will always be the | 80 //! Process Environment Block. The main executable will always be the |
66 //! first element. | 81 //! first element. |
67 bool Modules(std::vector<std::wstring>* modules) const; | 82 bool Modules(std::vector<Module>* modules) const; |
68 | 83 |
69 private: | 84 private: |
70 template <class T> | 85 template <class T> |
71 friend bool ReadProcessData(HANDLE process, | 86 friend bool ReadProcessData(HANDLE process, |
72 uintptr_t peb_address_uintptr, | 87 uintptr_t peb_address_uintptr, |
73 ProcessInfo* process_info); | 88 ProcessInfo* process_info); |
74 | 89 |
75 pid_t process_id_; | 90 pid_t process_id_; |
76 pid_t inherited_from_process_id_; | 91 pid_t inherited_from_process_id_; |
77 std::wstring command_line_; | 92 std::wstring command_line_; |
78 std::vector<std::wstring> modules_; | 93 std::vector<Module> modules_; |
79 bool is_64_bit_; | 94 bool is_64_bit_; |
80 bool is_wow64_; | 95 bool is_wow64_; |
81 InitializationStateDcheck initialized_; | 96 InitializationStateDcheck initialized_; |
82 | 97 |
83 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); | 98 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); |
84 }; | 99 }; |
85 | 100 |
86 } // namespace crashpad | 101 } // namespace crashpad |
87 | 102 |
88 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | 103 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ |
OLD | NEW |