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 <sys/types.h> | |
19 #include <windows.h> | |
20 #include <winternl.h> | |
21 | |
22 #include <string> | |
23 #include <vector> | |
24 | |
25 #include "util/misc/initialization_state_dcheck.h" | |
26 | |
27 namespace crashpad { | |
28 | |
29 class ProcessInfo { | |
30 public: | |
31 ProcessInfo(); | |
32 ~ProcessInfo(); | |
33 | |
34 //! \brief Initializes this object with information about the given | |
35 //! \a process. | |
36 //! | |
37 //! This method must be called successfully prior to calling any other | |
38 //! method in this class. This method may only be called once. | |
39 //! | |
40 //! \return `true` on success, `false` on failure with a message logged. | |
41 bool Initialize(HANDLE process); | |
42 | |
43 //! \return `true` if the target process is a 64-bit process. | |
44 bool Is64Bit() const; | |
45 | |
46 //! \return `true` if the target process is running on the Win32-on-Win64 | |
47 //! subsystem. | |
48 bool IsWow64() const; | |
Mark Mentovai
2015/03/05 17:32:23
IsWoW64() (two capital double-yous)?
scottmg
2015/03/05 20:31:07
I prefer not, but am happy to change it if you lik
Mark Mentovai
2015/03/05 21:53:36
scottmg wrote:
| |
49 | |
50 //! \return The target process's process ID. | |
51 pid_t ProcessID() const; | |
52 | |
53 //! \return The target process's parent process ID. | |
54 pid_t ParentProcessID() const; | |
55 | |
56 //! \return The command line from the target process's Process Environment | |
57 //! Block. | |
58 bool CommandLine(std::wstring* command_line) const; | |
59 | |
60 //! \brief Retrieves the modules loaded into the target process. | |
61 //! | |
62 //! The modules are enumerated in initialization order as detailed in the | |
63 //! Process Environment Block. | |
Mark Mentovai
2015/03/05 17:32:23
Will the main executable always appear at index 0?
scottmg
2015/03/05 20:31:07
Unfortunately, one drawback of InitializationOrder
Mark Mentovai
2015/03/05 21:53:36
scottmg wrote:
scottmg
2015/03/06 00:42:52
Inserting it at index 0 seems simplest for now.
Mark Mentovai
2015/03/06 14:33:30
scottmg wrote:
| |
64 bool Modules(std::vector<std::wstring>* modules) const; | |
65 | |
66 private: | |
67 PROCESS_BASIC_INFORMATION process_basic_information_; | |
68 std::wstring command_line_; | |
69 std::vector<std::wstring> modules_; | |
70 bool is64bit_; | |
Mark Mentovai
2015/03/05 17:32:23
is_64_bit_, is_wow64_
scottmg
2015/03/05 20:31:07
Done.
| |
71 BOOL iswow64_; | |
72 InitializationStateDcheck initialized_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); | |
Mark Mentovai
2015/03/05 17:32:23
#include "base/basictypes.h"
scottmg
2015/03/05 20:31:07
Done.
| |
75 }; | |
76 | |
77 } // namespace crashpad | |
78 | |
79 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ | |
OLD | NEW |