Chromium Code Reviews| Index: util/win/process_info.cc |
| diff --git a/util/win/process_info.cc b/util/win/process_info.cc |
| index 64fb79b04d2243801aedcfdd7b446d34337911e7..08c387f78bc7454dd7d83cd23ca0e611c6ba7f9e 100644 |
| --- a/util/win/process_info.cc |
| +++ b/util/win/process_info.cc |
| @@ -110,7 +110,8 @@ template <class Traits> |
| bool GetProcessBasicInformation(HANDLE process, |
| bool is_wow64, |
| ProcessInfo* process_info, |
| - WinVMAddress* peb_address) { |
| + WinVMAddress* peb_address, |
| + WinVMSize* peb_size) { |
| ULONG bytes_returned; |
| process_types::PROCESS_BASIC_INFORMATION<Traits> process_basic_information; |
| NTSTATUS status = |
| @@ -143,6 +144,7 @@ bool GetProcessBasicInformation(HANDLE process, |
| // The address of this is found by a second call to NtQueryInformationProcess. |
| if (!is_wow64) { |
| *peb_address = process_basic_information.PebBaseAddress; |
| + *peb_size = sizeof(process_types::PEB<Traits>); |
| } else { |
| ULONG_PTR wow64_peb_address; |
| status = crashpad::NtQueryInformationProcess(process, |
| @@ -159,6 +161,7 @@ bool GetProcessBasicInformation(HANDLE process, |
| return false; |
| } |
| *peb_address = wow64_peb_address; |
| + *peb_size = sizeof(process_types::PEB<process_types::internal::Traits32>); |
| } |
| return true; |
| @@ -260,6 +263,8 @@ ProcessInfo::ProcessInfo() |
| : process_id_(), |
| inherited_from_process_id_(), |
| command_line_(), |
| + peb_address_(), |
|
Mark Mentovai
2015/09/23 21:40:50
_(0), next line too.
scottmg
2015/09/24 20:00:10
Done.
|
| + peb_size_(), |
| modules_(), |
| is_64_bit_(false), |
| is_wow64_(false), |
| @@ -293,13 +298,12 @@ bool ProcessInfo::Initialize(HANDLE process) { |
| } |
| #endif |
| - WinVMAddress peb_address; |
| #if ARCH_CPU_64_BITS |
| bool result = GetProcessBasicInformation<process_types::internal::Traits64>( |
| - process, is_wow64_, this, &peb_address); |
| + process, is_wow64_, this, &peb_address_, &peb_size_); |
| #else |
| bool result = GetProcessBasicInformation<process_types::internal::Traits32>( |
| - process, false, this, &peb_address); |
| + process, false, this, &peb_address_, &peb_size_); |
| #endif // ARCH_CPU_64_BITS |
| if (!result) { |
| @@ -308,9 +312,9 @@ bool ProcessInfo::Initialize(HANDLE process) { |
| } |
| result = is_64_bit_ ? ReadProcessData<process_types::internal::Traits64>( |
| - process, peb_address, this) |
| - : ReadProcessData<process_types::internal::Traits32>( |
| - process, peb_address, this); |
| + process, peb_address_, this) |
| + : ReadProcessData<process_types::internal::Traits32>( |
| + process, peb_address_, this); |
| if (!result) { |
| LOG(ERROR) << "ReadProcessData failed"; |
| return false; |
| @@ -346,6 +350,11 @@ bool ProcessInfo::CommandLine(std::wstring* command_line) const { |
| return true; |
| } |
| +void ProcessInfo::Peb(WinVMAddress* peb_address, WinVMSize* peb_size) const { |
| + *peb_address = peb_address_; |
| + *peb_size = peb_size_; |
| +} |
| + |
| bool ProcessInfo::Modules(std::vector<Module>* modules) const { |
| INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| *modules = modules_; |