OLD | NEW |
---|---|
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 Loading... | |
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 process_id_ = static_cast<DWORD>(process_basic_information.UniqueProcessId); |
Mark Mentovai
2015/05/04 21:21:59
The comment you left in Rietveld was very helpful
| |
263 inherited_from_process_id_ = | 263 inherited_from_process_id_ = static_cast<DWORD>( |
264 process_basic_information.InheritedFromUniqueProcessId; | 264 process_basic_information.InheritedFromUniqueProcessId); |
265 | 265 |
266 // We now want to read the PEB to gather the rest of our information. The | 266 // 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, | 267 // 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). | 268 // 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. | 269 // The address of this is found by a second call to NtQueryInformationProcess. |
270 WinVMAddress peb_address = process_basic_information.PebBaseAddress; | 270 WinVMAddress peb_address = process_basic_information.PebBaseAddress; |
271 if (is_wow64_) { | 271 if (is_wow64_) { |
272 ULONG_PTR wow64_peb_address; | 272 ULONG_PTR wow64_peb_address; |
273 status = | 273 status = |
274 crashpad::NtQueryInformationProcess(process, | 274 crashpad::NtQueryInformationProcess(process, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 return true; | 325 return true; |
326 } | 326 } |
327 | 327 |
328 bool ProcessInfo::Modules(std::vector<Module>* modules) const { | 328 bool ProcessInfo::Modules(std::vector<Module>* modules) const { |
329 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 329 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
330 *modules = modules_; | 330 *modules = modules_; |
331 return true; | 331 return true; |
332 } | 332 } |
333 | 333 |
334 } // namespace crashpad | 334 } // namespace crashpad |
OLD | NEW |