Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 //! \brief The base address of the loaded DLL. | 42 //! \brief The base address of the loaded DLL. |
| 43 WinVMAddress dll_base; | 43 WinVMAddress dll_base; |
| 44 | 44 |
| 45 //! \brief The size of the module. | 45 //! \brief The size of the module. |
| 46 WinVMSize size; | 46 WinVMSize size; |
| 47 | 47 |
| 48 //! \brief The module's timestamp. | 48 //! \brief The module's timestamp. |
| 49 time_t timestamp; | 49 time_t timestamp; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // \brief Contains information about a range of pages in the virtual address | |
| 53 // space of a process. | |
| 54 struct MemoryInfo { | |
| 55 MemoryInfo(); | |
|
Mark Mentovai
2015/09/26 03:36:36
Is this form needed because of the vector?
scottmg
2015/09/26 04:08:53
No, just habit. Removed.
| |
| 56 explicit MemoryInfo(const MEMORY_BASIC_INFORMATION& mbi); | |
| 57 ~MemoryInfo(); | |
| 58 | |
| 59 //! \brief The base address of the region of pages. | |
| 60 WinVMAddress base_address; | |
| 61 | |
| 62 //! \brief The size of the region beginning at base_address in bytes. | |
| 63 WinVMSize region_size; | |
| 64 | |
| 65 //! \brief The base address of a range of pages that was allocated by | |
| 66 //! `VirtualAlloc()`. The page pointed to base_address is within this | |
| 67 //! range of pages. | |
| 68 WinVMAddress allocation_base; | |
| 69 | |
| 70 //! \brief The state of the pages, one of `MEM_COMMIT`, `MEM_FREE`, or | |
| 71 //! `MEM_RESERVE`. | |
| 72 uint32_t state; | |
| 73 | |
| 74 //! \brief The memory protection option when this page was originally | |
| 75 //! allocated. This will be `PAGE_EXECUTE`, `PAGE_EXECUTE_READ`, etc. | |
| 76 uint32_t allocation_protect; | |
| 77 | |
| 78 //! \brief The current memoryprotection state. This will be `PAGE_EXECUTE`, | |
| 79 //! `PAGE_EXECUTE_READ`, etc. | |
| 80 uint32_t protect; | |
| 81 | |
| 82 //! \brief The type of the pages. This will be one of `MEM_IMAGE`, | |
| 83 //! `MEM_MAPPED`, or `MEM_PRIVATE`. | |
| 84 uint32_t type; | |
| 85 }; | |
| 86 | |
| 52 ProcessInfo(); | 87 ProcessInfo(); |
| 53 ~ProcessInfo(); | 88 ~ProcessInfo(); |
| 54 | 89 |
| 55 //! \brief Initializes this object with information about the given | 90 //! \brief Initializes this object with information about the given |
| 56 //! \a process. | 91 //! \a process. |
| 57 //! | 92 //! |
| 58 //! This method must be called successfully prior to calling any other | 93 //! This method must be called successfully prior to calling any other |
| 59 //! method in this class. This method may only be called once. | 94 //! method in this class. This method may only be called once. |
| 60 //! | 95 //! |
| 61 //! \return `true` on success, `false` on failure with a message logged. | 96 //! \return `true` on success, `false` on failure with a message logged. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 85 //! \param[out] peb_size The size of the Process Environment Block. | 120 //! \param[out] peb_size The size of the Process Environment Block. |
| 86 void Peb(WinVMAddress* peb_address, WinVMSize* peb_size) const; | 121 void Peb(WinVMAddress* peb_address, WinVMSize* peb_size) const; |
| 87 | 122 |
| 88 //! \brief Retrieves the modules loaded into the target process. | 123 //! \brief Retrieves the modules loaded into the target process. |
| 89 //! | 124 //! |
| 90 //! The modules are enumerated in initialization order as detailed in the | 125 //! The modules are enumerated in initialization order as detailed in the |
| 91 //! Process Environment Block. The main executable will always be the | 126 //! Process Environment Block. The main executable will always be the |
| 92 //! first element. | 127 //! first element. |
| 93 bool Modules(std::vector<Module>* modules) const; | 128 bool Modules(std::vector<Module>* modules) const; |
| 94 | 129 |
| 130 //! \brief Retrieves information about all pages mapped into the process. | |
| 131 const std::vector<MemoryInfo>& MemoryInformation() const; | |
| 132 | |
| 95 private: | 133 private: |
| 96 template <class Traits> | 134 template <class Traits> |
| 97 friend bool GetProcessBasicInformation(HANDLE process, | 135 friend bool GetProcessBasicInformation(HANDLE process, |
| 98 bool is_wow64, | 136 bool is_wow64, |
| 99 ProcessInfo* process_info, | 137 ProcessInfo* process_info, |
| 100 WinVMAddress* peb_address, | 138 WinVMAddress* peb_address, |
| 101 WinVMSize* peb_size); | 139 WinVMSize* peb_size); |
| 102 template <class Traits> | 140 template <class Traits> |
| 103 friend bool ReadProcessData(HANDLE process, | 141 friend bool ReadProcessData(HANDLE process, |
| 104 WinVMAddress peb_address_vmaddr, | 142 WinVMAddress peb_address_vmaddr, |
| 105 ProcessInfo* process_info); | 143 ProcessInfo* process_info); |
| 106 | 144 |
| 145 friend bool ReadMemoryInfo(HANDLE process, ProcessInfo* process_info); | |
| 146 | |
| 107 pid_t process_id_; | 147 pid_t process_id_; |
| 108 pid_t inherited_from_process_id_; | 148 pid_t inherited_from_process_id_; |
| 109 std::wstring command_line_; | 149 std::wstring command_line_; |
| 110 WinVMAddress peb_address_; | 150 WinVMAddress peb_address_; |
| 111 WinVMSize peb_size_; | 151 WinVMSize peb_size_; |
| 112 std::vector<Module> modules_; | 152 std::vector<Module> modules_; |
| 153 std::vector<MemoryInfo> memory_info_; | |
| 113 bool is_64_bit_; | 154 bool is_64_bit_; |
| 114 bool is_wow64_; | 155 bool is_wow64_; |
| 115 InitializationStateDcheck initialized_; | 156 InitializationStateDcheck initialized_; |
| 116 | 157 |
| 117 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); | 158 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); |
| 118 }; | 159 }; |
| 119 | 160 |
| 120 } // namespace crashpad | 161 } // namespace crashpad |
| 121 | 162 |
| 122 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | 163 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ |
| OLD | NEW |