OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (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 | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | |
16 #define CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | |
17 | |
18 #include <basetsd.h> | |
19 #include <sys/types.h> | |
20 #include <windows.h> | |
21 #include <winternl.h> | |
22 | |
23 #include <string> | |
24 #include <vector> | |
25 | |
26 #include "base/basictypes.h" | |
27 #include "util/misc/initialization_state_dcheck.h" | |
28 | |
29 namespace crashpad { | |
30 | |
31 struct FULL_PROCESS_BASIC_INFORMATION { | |
Mark Mentovai
2015/03/05 21:53:36
Put this into namespace internal. Also, add a clas
scottmg
2015/03/06 00:42:52
Done.
| |
32 NTSTATUS ExitStatus; | |
33 PPEB PebBaseAddress; | |
34 KAFFINITY AffinityMask; | |
35 PVOID BasePriority; | |
36 ULONG UniqueProcessId; | |
37 ULONG InheritedFromUniqueProcessId; | |
38 }; | |
39 | |
40 class ProcessInfo { | |
Mark Mentovai
2015/03/05 21:53:36
Class-level comment?
scottmg
2015/03/06 00:42:52
Done.
| |
41 public: | |
42 ProcessInfo(); | |
43 ~ProcessInfo(); | |
44 | |
45 //! \brief Initializes this object with information about the given | |
46 //! \a process. | |
47 //! | |
48 //! This method must be called successfully prior to calling any other | |
49 //! method in this class. This method may only be called once. | |
50 //! | |
51 //! \return `true` on success, `false` on failure with a message logged. | |
52 bool Initialize(HANDLE process); | |
53 | |
54 //! \return `true` if the target process is a 64-bit process. | |
55 bool Is64Bit() const; | |
56 | |
57 //! \return `true` if the target process is running on the Win32-on-Win64 | |
58 //! subsystem. | |
59 bool IsWow64() const; | |
60 | |
61 //! \return The target process's process ID. | |
62 pid_t ProcessID() const; | |
63 | |
64 //! \return The target process's parent process ID. | |
65 pid_t ParentProcessID() const; | |
66 | |
67 //! \return The command line from the target process's Process Environment | |
68 //! Block. | |
69 bool CommandLine(std::wstring* command_line) const; | |
70 | |
71 //! \brief Retrieves the modules loaded into the target process. | |
72 //! | |
73 //! The modules are enumerated in initialization order as detailed in the | |
74 //! Process Environment Block. | |
75 bool Modules(std::vector<std::wstring>* modules) const; | |
76 | |
77 private: | |
78 FULL_PROCESS_BASIC_INFORMATION process_basic_information_; | |
79 std::wstring command_line_; | |
80 std::vector<std::wstring> modules_; | |
81 bool is_64_bit_; | |
82 bool is_wow64_; | |
83 InitializationStateDcheck initialized_; | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); | |
86 }; | |
87 | |
88 } // namespace crashpad | |
89 | |
90 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | |
OLD | NEW |