Chromium Code Reviews| Index: snapshot/win/process_reader_win.cc |
| diff --git a/snapshot/win/process_reader_win.cc b/snapshot/win/process_reader_win.cc |
| index 383a66464a113334dd593e004d0d733da4b543a4..1357dea41ea67e21b39fb156058d5dedfcdac295 100644 |
| --- a/snapshot/win/process_reader_win.cc |
| +++ b/snapshot/win/process_reader_win.cc |
| @@ -16,7 +16,11 @@ |
| namespace crashpad { |
| -ProcessReaderWin::ProcessReaderWin() : process_info_(), initialized_() { |
| +ProcessReaderWin::ProcessReaderWin() |
| + : process_(INVALID_HANDLE_VALUE), |
| + process_info_(), |
| + modules_(), |
| + initialized_() { |
| } |
| ProcessReaderWin::~ProcessReaderWin() { |
| @@ -25,10 +29,37 @@ ProcessReaderWin::~ProcessReaderWin() { |
| bool ProcessReaderWin::Initialize(HANDLE process) { |
| INITIALIZATION_STATE_SET_INITIALIZING(initialized_); |
| + process_ = process; |
| process_info_.Initialize(process); |
| INITIALIZATION_STATE_SET_VALID(initialized_); |
| return true; |
| } |
| +bool ProcessReaderWin::ReadMemory(uintptr_t at, |
| + size_t num_bytes, |
| + void* into) { |
| + SIZE_T bytes_read; |
| + if (!ReadProcessMemory(process_, |
| + reinterpret_cast<void*>(at), |
| + into, |
| + num_bytes, |
| + &bytes_read) || |
| + num_bytes != bytes_read) { |
| + LOG(ERROR) << "ReadMemory at " << at << " of " << num_bytes << " failed"; |
|
Mark Mentovai
2015/04/29 19:37:15
PLOG
scottmg
2015/04/30 03:31:32
Done.
|
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| +const std::vector<ProcessInfo::Module>& ProcessReaderWin::Modules() { |
| + INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| + |
| + if (!process_info_.Modules(&modules_)) { |
| + LOG(ERROR) << "couldn't retrieve modules"; |
| + } |
| + |
| + return modules_; |
| +} |
| + |
| } // namespace crashpad |