Chromium Code Reviews| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| 195 | 195 |
| 196 PEImageResourceReader resource_reader; | 196 PEImageResourceReader resource_reader; |
| 197 if (!resource_reader.Initialize(module_subrange_reader_, data_directory)) { | 197 if (!resource_reader.Initialize(module_subrange_reader_, data_directory)) { |
| 198 return false; | 198 return false; |
| 199 } | 199 } |
| 200 | 200 |
| 201 WinVMAddress address; | 201 WinVMAddress address; |
| 202 WinVMSize size; | 202 WinVMSize size; |
| 203 // Do two casts to make it explicit that we are intentionally both converting | |
|
Mark Mentovai
2015/12/14 23:51:30
I don’t think the comment is necessary. Weird cast
brucedawson
2015/12/15 00:00:56
Done.
| |
| 204 // from pointer to int, and doing a truncation. This avoids a VC++ 2015 | |
| 205 // warning. | |
| 206 const uint16_t type = | |
|
Mark Mentovai
2015/12/14 23:51:30
but I’d name it vs_file_info_type.
brucedawson
2015/12/15 00:00:56
Done.
| |
| 207 static_cast<uint16_t>(reinterpret_cast<uintptr_t>(VS_FILE_INFO)); | |
| 203 if (!resource_reader.FindResourceByID( | 208 if (!resource_reader.FindResourceByID( |
| 204 reinterpret_cast<uint16_t>(VS_FILE_INFO), // RT_VERSION | 209 type, // RT_VERSION |
| 205 VS_VERSION_INFO, | 210 VS_VERSION_INFO, |
| 206 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), | 211 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), |
| 207 &address, | 212 &address, |
| 208 &size, | 213 &size, |
| 209 nullptr)) { | 214 nullptr)) { |
| 210 return false; | 215 return false; |
| 211 } | 216 } |
| 212 | 217 |
| 213 // This structure is not declared anywhere in the SDK, but is documented at | 218 // This structure is not declared anywhere in the SDK, but is documented at |
| 214 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647001.aspx. | 219 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647001.aspx. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 // Explicit instantiations with the only 2 valid template arguments to avoid | 381 // Explicit instantiations with the only 2 valid template arguments to avoid |
| 377 // putting the body of the function in the header. | 382 // putting the body of the function in the header. |
| 378 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits32>( | 383 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits32>( |
| 379 process_types::CrashpadInfo<process_types::internal::Traits32>* | 384 process_types::CrashpadInfo<process_types::internal::Traits32>* |
| 380 crashpad_info) const; | 385 crashpad_info) const; |
| 381 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits64>( | 386 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits64>( |
| 382 process_types::CrashpadInfo<process_types::internal::Traits64>* | 387 process_types::CrashpadInfo<process_types::internal::Traits64>* |
| 383 crashpad_info) const; | 388 crashpad_info) const; |
| 384 | 389 |
| 385 } // namespace crashpad | 390 } // namespace crashpad |
| OLD | NEW |