OLD | NEW |
1 // Copyright 2015 Google Inc. All Rights Reserved. | 1 // Copyright 2015 Google Inc. 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // Get the module version. We start by grabbing the product version from the | 129 // Get the module version. We start by grabbing the product version from the |
130 // file version information. | 130 // file version information. |
131 module_version_.clear(); | 131 module_version_.clear(); |
132 std::unique_ptr<FileVersionInfo> version_info( | 132 std::unique_ptr<FileVersionInfo> version_info( |
133 FileVersionInfo::CreateFileVersionInfo(file_path)); | 133 FileVersionInfo::CreateFileVersionInfo(file_path)); |
134 if (version_info) | 134 if (version_info) |
135 module_version_ = version_info->product_version(); | 135 module_version_ = version_info->product_version(); |
136 if (module_version_.empty()) { | 136 if (module_version_.empty()) { |
137 // If that fails, we try grabbing the version from the PE signature. | 137 // If that fails, we try grabbing the version from the PE signature. |
| 138 #ifndef _WIN64 |
138 pe::PEFile pe_file; | 139 pe::PEFile pe_file; |
| 140 pe::PEFile::Signature signature; |
| 141 #else |
| 142 pe::PEFile64 pe_file; |
| 143 pe::PEFile64::Signature signature; |
| 144 #endif |
139 if (pe_file.Init(file_path)) { | 145 if (pe_file.Init(file_path)) { |
140 pe::PEFile::Signature signature; | |
141 pe_file.GetSignature(&signature); | 146 pe_file.GetSignature(&signature); |
142 module_version_ = base::StringPrintf( | 147 module_version_ = base::StringPrintf( |
143 L"%08X%x", signature.module_time_date_stamp, signature.module_size); | 148 L"%08X%x", signature.module_time_date_stamp, signature.module_size); |
144 } else { | 149 } else { |
145 // If all fails, we bail. | 150 // If all fails, we bail. |
146 LOG(ERROR) << "Cannot get the module version."; | 151 LOG(ERROR) << "Cannot get the module version."; |
147 return false; | 152 return false; |
148 } | 153 } |
149 } | 154 } |
150 module_key_name_ = registry_cache_key_; | 155 module_key_name_ = registry_cache_key_; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); | 283 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); |
279 iter.Valid(); ++iter) { | 284 iter.Valid(); ++iter) { |
280 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); | 285 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); |
281 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); | 286 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); |
282 entries_.insert(*ptr_value); | 287 entries_.insert(*ptr_value); |
283 } | 288 } |
284 } | 289 } |
285 | 290 |
286 } // namespace asan | 291 } // namespace asan |
287 } // namespace agent | 292 } // namespace agent |
OLD | NEW |