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

Side by Side Diff: chrome/browser/conflicts/module_event_sink_impl_win.cc

Issue 2685213002: Fix ReadRemoteData in ModuleEventSinkImpl (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/conflicts/module_event_sink_impl_win.h" 5 #include "chrome/browser/conflicts/module_event_sink_impl_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return true; 57 return true;
58 } 58 }
59 59
60 // Reads the typed data from a remote process. Returns true on success, false 60 // Reads the typed data from a remote process. Returns true on success, false
61 // otherwise. 61 // otherwise.
62 template <typename T> 62 template <typename T>
63 bool ReadRemoteData(base::ProcessHandle process, uint64_t address, T* data) { 63 bool ReadRemoteData(base::ProcessHandle process, uint64_t address, T* data) {
64 const void* typed_address = 64 const void* typed_address =
65 reinterpret_cast<const void*>(static_cast<uintptr_t>(address)); 65 reinterpret_cast<const void*>(static_cast<uintptr_t>(address));
66 SIZE_T bytes_read = 0; 66 SIZE_T bytes_read = 0;
67 if (!::ReadProcessMemory(process, typed_address, &data, sizeof(data), 67 if (!::ReadProcessMemory(process, typed_address, data, sizeof(data),
Nico 2017/02/15 15:35:09 This still looks a bit funny. sizeof(data) will al
68 &bytes_read)) { 68 &bytes_read)) {
69 return false; 69 return false;
70 } 70 }
71 if (bytes_read != sizeof(data)) 71 if (bytes_read != sizeof(data))
72 return false; 72 return false;
73 return true; 73 return true;
74 } 74 }
75 75
76 // Reads the time date stamp from the module loaded in the provided remote 76 // Reads the time date stamp from the module loaded in the provided remote
77 // |process| at the provided remote |load_address|. 77 // |process| at the provided remote |load_address|.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 module_database_->OnModuleLoad(process_id_, creation_time_, module_path, 202 module_database_->OnModuleLoad(process_id_, creation_time_, module_path,
203 module_size, module_time_date_stamp, 203 module_size, module_time_date_stamp,
204 load_address); 204 load_address);
205 } 205 }
206 206
207 void ModuleEventSinkImpl::OnModuleUnload(uint64_t load_address) { 207 void ModuleEventSinkImpl::OnModuleUnload(uint64_t load_address) {
208 // Forward this directly to the module database. 208 // Forward this directly to the module database.
209 module_database_->OnModuleUnload(process_id_, creation_time_, 209 module_database_->OnModuleUnload(process_id_, creation_time_,
210 static_cast<uintptr_t>(load_address)); 210 static_cast<uintptr_t>(load_address));
211 } 211 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698