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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 // Get the module version. We start by grabbing the product version from the | 140 // Get the module version. We start by grabbing the product version from the |
141 // file version information. | 141 // file version information. |
142 module_version_.clear(); | 142 module_version_.clear(); |
143 std::unique_ptr<FileVersionInfo> version_info( | 143 std::unique_ptr<FileVersionInfo> version_info( |
144 FileVersionInfo::CreateFileVersionInfo(file_path)); | 144 FileVersionInfo::CreateFileVersionInfo(file_path)); |
145 if (version_info) | 145 if (version_info) |
146 module_version_ = version_info->product_version(); | 146 module_version_ = version_info->product_version(); |
147 if (module_version_.empty()) { | 147 if (module_version_.empty()) { |
148 // If that fails, we try grabbing the version from the PE signature. | 148 // If that fails, we try grabbing the version from the PE signature. |
| 149 #ifndef _WIN64 |
149 pe::PEFile pe_file; | 150 pe::PEFile pe_file; |
| 151 pe::PEFile::Signature signature; |
| 152 #else |
| 153 pe::PEFile64 pe_file; |
| 154 pe::PEFile64::Signature signature; |
| 155 #endif |
150 if (pe_file.Init(file_path)) { | 156 if (pe_file.Init(file_path)) { |
151 pe::PEFile::Signature signature; | |
152 pe_file.GetSignature(&signature); | 157 pe_file.GetSignature(&signature); |
153 module_version_ = base::StringPrintf( | 158 module_version_ = base::StringPrintf( |
154 L"%08X%x", signature.module_time_date_stamp, signature.module_size); | 159 L"%08X%x", signature.module_time_date_stamp, signature.module_size); |
155 } else { | 160 } else { |
156 // If all fails, we bail. | 161 // If all fails, we bail. |
157 LOG(ERROR) << "Cannot get the module version."; | 162 LOG(ERROR) << "Cannot get the module version."; |
158 return false; | 163 return false; |
159 } | 164 } |
160 } | 165 } |
161 module_key_name_ = registry_cache_key_; | 166 module_key_name_ = registry_cache_key_; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); | 294 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); |
290 iter.Valid(); ++iter) { | 295 iter.Valid(); ++iter) { |
291 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); | 296 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); |
292 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); | 297 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); |
293 entries_.insert(*ptr_value); | 298 entries_.insert(*ptr_value); |
294 } | 299 } |
295 } | 300 } |
296 | 301 |
297 } // namespace asan | 302 } // namespace asan |
298 } // namespace agent | 303 } // namespace agent |
OLD | NEW |