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

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

Issue 1120383003: Get generate_dump compiling on Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@tools
Patch Set: fix mac; no implicit conversion to std::string for StringPiece 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
« no previous file with comments | « tools/tools.gyp ('k') | 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 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 sizeof(process_basic_information), 252 sizeof(process_basic_information),
253 &bytes_returned); 253 &bytes_returned);
254 if (status < 0) { 254 if (status < 0) {
255 LOG(ERROR) << "NtQueryInformationProcess: status=" << status; 255 LOG(ERROR) << "NtQueryInformationProcess: status=" << status;
256 return false; 256 return false;
257 } 257 }
258 if (bytes_returned != sizeof(process_basic_information)) { 258 if (bytes_returned != sizeof(process_basic_information)) {
259 LOG(ERROR) << "NtQueryInformationProcess incorrect size"; 259 LOG(ERROR) << "NtQueryInformationProcess incorrect size";
260 return false; 260 return false;
261 } 261 }
262 process_id_ = process_basic_information.UniqueProcessId; 262
263 inherited_from_process_id_ = 263 // See https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203 on
264 process_basic_information.InheritedFromUniqueProcessId; 264 // 32 bit being the correct size for HANDLEs for proceses, even on Windows
265 // x64. API functions (e.g. OpenProcess) take only a DWORD, so there's no
266 // sense in maintaining the top bits.
267 process_id_ = static_cast<DWORD>(process_basic_information.UniqueProcessId);
268 inherited_from_process_id_ = static_cast<DWORD>(
269 process_basic_information.InheritedFromUniqueProcessId);
265 270
266 // We now want to read the PEB to gather the rest of our information. The 271 // We now want to read the PEB to gather the rest of our information. The
267 // PebBaseAddress as returned above is what we want for 64-on-64 and 32-on-32, 272 // PebBaseAddress as returned above is what we want for 64-on-64 and 32-on-32,
268 // but for Wow64, we want to read the 32 bit PEB (a Wow64 process has both). 273 // but for Wow64, we want to read the 32 bit PEB (a Wow64 process has both).
269 // The address of this is found by a second call to NtQueryInformationProcess. 274 // The address of this is found by a second call to NtQueryInformationProcess.
270 WinVMAddress peb_address = process_basic_information.PebBaseAddress; 275 WinVMAddress peb_address = process_basic_information.PebBaseAddress;
271 if (is_wow64_) { 276 if (is_wow64_) {
272 ULONG_PTR wow64_peb_address; 277 ULONG_PTR wow64_peb_address;
273 status = 278 status =
274 crashpad::NtQueryInformationProcess(process, 279 crashpad::NtQueryInformationProcess(process,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return true; 330 return true;
326 } 331 }
327 332
328 bool ProcessInfo::Modules(std::vector<Module>* modules) const { 333 bool ProcessInfo::Modules(std::vector<Module>* modules) const {
329 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 334 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
330 *modules = modules_; 335 *modules = modules_;
331 return true; 336 return true;
332 } 337 }
333 338
334 } // namespace crashpad 339 } // namespace crashpad
OLDNEW
« no previous file with comments | « tools/tools.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698