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_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
17 | 17 |
18 #include <windows.h> | 18 #include <windows.h> |
19 | 19 |
20 #include "util/misc/initialization_state_dcheck.h" | 20 #include "util/misc/initialization_state_dcheck.h" |
| 21 #include "util/win/process_info.h" |
21 | 22 |
22 namespace crashpad { | 23 namespace crashpad { |
23 | 24 |
24 //! \brief Accesses information about another process, identified by a HANDLE. | 25 //! \brief Accesses information about another process, identified by a HANDLE. |
25 class ProcessReaderWin { | 26 class ProcessReaderWin { |
26 public: | 27 public: |
27 ProcessReaderWin(); | 28 ProcessReaderWin(); |
28 ~ProcessReaderWin(); | 29 ~ProcessReaderWin(); |
29 | 30 |
30 //! \brief Initializes this object. This method must be called before any | 31 //! \brief Initializes this object. This method must be called before any |
31 //! other. | 32 //! other. |
32 //! | 33 //! |
33 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION, | 34 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION, |
34 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access. | 35 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access. |
35 //! | 36 //! |
36 //! \return `true` on success, indicating that this object will respond | 37 //! \return `true` on success, indicating that this object will respond |
37 //! validly to further method calls. `false` on failure. On failure, no | 38 //! validly to further method calls. `false` on failure. On failure, no |
38 //! further method calls should be made. | 39 //! further method calls should be made. |
39 bool Initialize(HANDLE process); | 40 bool Initialize(HANDLE process); |
40 | 41 |
41 //! \return `true` if the target task is a 64-bit process. | 42 //! \return `true` if the target task is a 64-bit process. |
42 bool Is64Bit() const { return is_64_bit_; } | 43 bool Is64Bit() const { return process_info_.Is64Bit(); } |
43 | 44 |
44 private: | 45 private: |
45 bool is_64_bit_; | 46 ProcessInfo process_info_; |
46 InitializationStateDcheck initialized_; | 47 InitializationStateDcheck initialized_; |
47 | 48 |
48 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); | 49 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); |
49 }; | 50 }; |
50 | 51 |
51 } // namespace crashpad | 52 } // namespace crashpad |
52 | 53 |
53 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 54 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
OLD | NEW |