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 { |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 return NULL; | 551 return NULL; |
552 | 552 |
553 return reinterpret_cast<char*>(module_) + rva; | 553 return reinterpret_cast<char*>(module_) + rva; |
554 } | 554 } |
555 | 555 |
556 PVOID PEImageAsData::RVAToAddr(DWORD rva) const { | 556 PVOID PEImageAsData::RVAToAddr(DWORD rva) const { |
557 if (rva == 0) | 557 if (rva == 0) |
558 return NULL; | 558 return NULL; |
559 | 559 |
560 PVOID in_memory = PEImage::RVAToAddr(rva); | 560 PVOID in_memory = PEImage::RVAToAddr(rva); |
561 DWORD dummy; | 561 DWORD disk_offset; |
562 | 562 |
563 if (!ImageAddrToOnDiskOffset(in_memory, &dummy)) | 563 if (!ImageAddrToOnDiskOffset(in_memory, &disk_offset)) |
564 return NULL; | 564 return NULL; |
565 | 565 |
566 return in_memory; | 566 return PEImage::RVAToAddr(disk_offset); |
567 } | 567 } |
568 | 568 |
569 } // namespace win | 569 } // namespace win |
570 } // namespace base | 570 } // namespace base |
OLD | NEW |