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

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

Issue 1052813002: win: make CrashpadInfo retrievable (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 7 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
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,
(...skipping 12 matching lines...) Expand all
23 23
24 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "util/misc/initialization_state_dcheck.h" 25 #include "util/misc/initialization_state_dcheck.h"
26 26
27 namespace crashpad { 27 namespace crashpad {
28 28
29 //! \brief Gathers information about a process given its `HANDLE`. This consists 29 //! \brief Gathers information about a process given its `HANDLE`. This consists
30 //! primarily of information stored in the Process Environment Block. 30 //! primarily of information stored in the Process Environment Block.
31 class ProcessInfo { 31 class ProcessInfo {
32 public: 32 public:
33 //! \brief Contains information about a module loaded into a process.
34 struct Module {
35 Module();
36 ~Module();
37
38 //! \brief The pathname used to load the module from disk.
39 std::wstring name;
40
41 //! \brief The base address of the loaded DLL.
42 uintptr_t dll_base;
43
44 //! \brief The size of the module.
45 uintptr_t size;
46
47 //! \brief The module's timestamp.
48 time_t timestamp;
49 };
50
33 ProcessInfo(); 51 ProcessInfo();
34 ~ProcessInfo(); 52 ~ProcessInfo();
35 53
36 //! \brief Initializes this object with information about the given 54 //! \brief Initializes this object with information about the given
37 //! \a process. 55 //! \a process.
38 //! 56 //!
39 //! This method must be called successfully prior to calling any other 57 //! This method must be called successfully prior to calling any other
40 //! method in this class. This method may only be called once. 58 //! method in this class. This method may only be called once.
41 //! 59 //!
42 //! \return `true` on success, `false` on failure with a message logged. 60 //! \return `true` on success, `false` on failure with a message logged.
(...skipping 14 matching lines...) Expand all
57 75
58 //! \return The command line from the target process's Process Environment 76 //! \return The command line from the target process's Process Environment
59 //! Block. 77 //! Block.
60 bool CommandLine(std::wstring* command_line) const; 78 bool CommandLine(std::wstring* command_line) const;
61 79
62 //! \brief Retrieves the modules loaded into the target process. 80 //! \brief Retrieves the modules loaded into the target process.
63 //! 81 //!
64 //! The modules are enumerated in initialization order as detailed in the 82 //! The modules are enumerated in initialization order as detailed in the
65 //! Process Environment Block. The main executable will always be the 83 //! Process Environment Block. The main executable will always be the
66 //! first element. 84 //! first element.
67 bool Modules(std::vector<std::wstring>* modules) const; 85 bool Modules(std::vector<Module>* modules) const;
68 86
69 private: 87 private:
70 template <class T> 88 template <class T>
71 friend bool ReadProcessData(HANDLE process, 89 friend bool ReadProcessData(HANDLE process,
72 uintptr_t peb_address_uintptr, 90 uintptr_t peb_address_uintptr,
73 ProcessInfo* process_info); 91 ProcessInfo* process_info);
74 92
75 pid_t process_id_; 93 pid_t process_id_;
76 pid_t inherited_from_process_id_; 94 pid_t inherited_from_process_id_;
77 std::wstring command_line_; 95 std::wstring command_line_;
78 std::vector<std::wstring> modules_; 96 std::vector<Module> modules_;
79 bool is_64_bit_; 97 bool is_64_bit_;
80 bool is_wow64_; 98 bool is_wow64_;
81 InitializationStateDcheck initialized_; 99 InitializationStateDcheck initialized_;
82 100
83 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); 101 DISALLOW_COPY_AND_ASSIGN(ProcessInfo);
84 }; 102 };
85 103
86 } // namespace crashpad 104 } // namespace crashpad
87 105
88 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ 106 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698