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