Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: util/win/process_info.h

Issue 981393003: win: Support reading process info cross-bitness (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@64-port-test-2
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/util.gyp ('k') | util/win/process_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <basetsd.h>
19 #include <sys/types.h> 18 #include <sys/types.h>
20 #include <windows.h> 19 #include <windows.h>
21 #include <winternl.h>
22 20
23 #include <string> 21 #include <string>
24 #include <vector> 22 #include <vector>
25 23
26 #include "base/basictypes.h" 24 #include "base/basictypes.h"
27 #include "util/misc/initialization_state_dcheck.h" 25 #include "util/misc/initialization_state_dcheck.h"
28 26
29 namespace crashpad { 27 namespace crashpad {
30 28
31 namespace internal {
32
33 //! \brief This structure matches PROCESS_BASIC_INFORMATION in winternl.h but
34 //! gives names to the Reserved fields (matching the WDK's ntddk.h).
35 struct FULL_PROCESS_BASIC_INFORMATION {
36 NTSTATUS ExitStatus;
37 PPEB PebBaseAddress;
38 KAFFINITY AffinityMask;
39 PVOID BasePriority;
40 ULONG_PTR UniqueProcessId;
41 ULONG_PTR InheritedFromUniqueProcessId;
42 };
43
44 } // namespace internal
45
46 //! \brief Gathers information about a process given its `HANDLE`. This consists 29 //! \brief Gathers information about a process given its `HANDLE`. This consists
47 //! primarily of information stored in the Process Environment Block. 30 //! primarily of information stored in the Process Environment Block.
48 class ProcessInfo { 31 class ProcessInfo {
49 public: 32 public:
50 ProcessInfo(); 33 ProcessInfo();
51 ~ProcessInfo(); 34 ~ProcessInfo();
52 35
53 //! \brief Initializes this object with information about the given 36 //! \brief Initializes this object with information about the given
54 //! \a process. 37 //! \a process.
55 //! 38 //!
(...skipping 21 matching lines...) Expand all
77 bool CommandLine(std::wstring* command_line) const; 60 bool CommandLine(std::wstring* command_line) const;
78 61
79 //! \brief Retrieves the modules loaded into the target process. 62 //! \brief Retrieves the modules loaded into the target process.
80 //! 63 //!
81 //! The modules are enumerated in initialization order as detailed in the 64 //! The modules are enumerated in initialization order as detailed in the
82 //! Process Environment Block. The main executable will always be the 65 //! Process Environment Block. The main executable will always be the
83 //! first element. 66 //! first element.
84 bool Modules(std::vector<std::wstring>* modules) const; 67 bool Modules(std::vector<std::wstring>* modules) const;
85 68
86 private: 69 private:
87 internal::FULL_PROCESS_BASIC_INFORMATION process_basic_information_; 70 template <class T>
71 friend bool ReadProcessData(HANDLE process,
72 uintptr_t peb_address_uintptr,
73 ProcessInfo* process_info);
74
75 pid_t process_id_;
76 pid_t inherited_from_process_id_;
88 std::wstring command_line_; 77 std::wstring command_line_;
89 std::vector<std::wstring> modules_; 78 std::vector<std::wstring> modules_;
90 bool is_64_bit_; 79 bool is_64_bit_;
91 bool is_wow64_; 80 bool is_wow64_;
92 InitializationStateDcheck initialized_; 81 InitializationStateDcheck initialized_;
93 82
94 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); 83 DISALLOW_COPY_AND_ASSIGN(ProcessInfo);
95 }; 84 };
96 85
97 } // namespace crashpad 86 } // namespace crashpad
98 87
99 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ 88 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_
OLDNEW
« no previous file with comments | « util/util.gyp ('k') | util/win/process_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698