OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file implements PEImage, a generic class to manipulate PE files. | 5 // This file implements PEImage, a generic class to manipulate PE files. |
6 // This file was adapted from GreenBorder's Code. | 6 // This file was adapted from GreenBorder's Code. |
7 | 7 |
8 #include "base/win/pe_image.h" | 8 #include "base/win/pe_image.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
11 namespace win { | 11 namespace win { |
12 | 12 |
13 #if defined(_WIN64) && !defined(NACL_WIN64) | 13 // TODO(jschuh): crbug.com/167707 Make sure this code works on 64-bit. |
14 // TODO(jschuh): crbug.com/167707 Make sure this is ok. | |
15 #pragma message ("Warning: \ | |
16 This code is not tested on x64. Please make sure all the base unit tests\ | |
17 pass before doing any real work. The current unit tests don't test the\ | |
18 differences between 32- and 64-bits implementations. Bugs may slip through.\ | |
19 You need to improve the coverage before continuing.") | |
20 #endif | |
21 | 14 |
22 // Structure to perform imports enumerations. | 15 // Structure to perform imports enumerations. |
23 struct EnumAllImportsStorage { | 16 struct EnumAllImportsStorage { |
24 PEImage::EnumImportsFunction callback; | 17 PEImage::EnumImportsFunction callback; |
25 PVOID cookie; | 18 PVOID cookie; |
26 }; | 19 }; |
27 | 20 |
28 namespace { | 21 namespace { |
29 | 22 |
30 // Compare two strings byte by byte on an unsigned basis. | 23 // Compare two strings byte by byte on an unsigned basis. |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 DWORD disk_offset; | 557 DWORD disk_offset; |
565 | 558 |
566 if (!ImageAddrToOnDiskOffset(in_memory, &disk_offset)) | 559 if (!ImageAddrToOnDiskOffset(in_memory, &disk_offset)) |
567 return NULL; | 560 return NULL; |
568 | 561 |
569 return PEImage::RVAToAddr(disk_offset); | 562 return PEImage::RVAToAddr(disk_offset); |
570 } | 563 } |
571 | 564 |
572 } // namespace win | 565 } // namespace win |
573 } // namespace base | 566 } // namespace base |
OLD | NEW |