OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/safe_browsing/pe_image_reader_win.h" | 5 #include "chrome/common/safe_browsing/pe_image_reader_win.h" |
6 | 6 |
7 #include <wintrust.h> | 7 #include <wintrust.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
10 | 11 |
11 namespace safe_browsing { | 12 namespace safe_browsing { |
12 | 13 |
13 // A class template of traits pertaining to IMAGE_OPTIONAL_HEADER{32,64}. | 14 // A class template of traits pertaining to IMAGE_OPTIONAL_HEADER{32,64}. |
14 template<class HEADER_TYPE> | 15 template<class HEADER_TYPE> |
15 struct OptionalHeaderTraits { | 16 struct OptionalHeaderTraits { |
16 }; | 17 }; |
17 | 18 |
18 template<> | 19 template<> |
19 struct OptionalHeaderTraits<IMAGE_OPTIONAL_HEADER32> { | 20 struct OptionalHeaderTraits<IMAGE_OPTIONAL_HEADER32> { |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 if (data_offset >= header->SizeOfRawData || | 369 if (data_offset >= header->SizeOfRawData || |
369 header->SizeOfRawData - data_offset < entry->Size) { | 370 header->SizeOfRawData - data_offset < entry->Size) { |
370 return NULL; | 371 return NULL; |
371 } | 372 } |
372 | 373 |
373 *data_length = entry->Size; | 374 *data_length = entry->Size; |
374 return image_data_ + header->PointerToRawData + data_offset; | 375 return image_data_ + header->PointerToRawData + data_offset; |
375 } | 376 } |
376 | 377 |
377 } // namespace safe_browsing | 378 } // namespace safe_browsing |
OLD | NEW |