OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // A helper class for loading resources out of portable executable files. |
| 6 |
| 7 #ifndef CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_ |
| 8 #define CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_ |
| 9 #pragma once |
| 10 |
| 11 #include <windows.h> |
| 12 |
| 13 #include <string> |
| 14 #include <utility> |
| 15 |
| 16 #include "base/basictypes.h" |
| 17 |
| 18 class FilePath; |
| 19 |
| 20 namespace upgrade_test { |
| 21 |
| 22 // Loads resources in a PE image file. |
| 23 class ResourceLoader { |
| 24 public: |
| 25 ResourceLoader(); |
| 26 ~ResourceLoader(); |
| 27 |
| 28 // Loads |pe_image_path| in preparation for loading its resources. |
| 29 bool Initialize(const FilePath& pe_image_path); |
| 30 |
| 31 // Places the address and size of the resource |name| of |type| into |
| 32 // |resource_data|, returning true on success. The address of the resource is |
| 33 // valid only until this instance is destroyed. |
| 34 bool Load(const std::wstring& name, const std::wstring& type, |
| 35 std::pair<const uint8*, DWORD>* resource_data); |
| 36 |
| 37 // Places the address and size of the resource |id| of |type| into |
| 38 // |resource_data|, returning true on success. The address of the resource is |
| 39 // valid only until this instance is destroyed. |
| 40 bool Load(WORD id, WORD type, std::pair<const uint8*, DWORD>* resource_data); |
| 41 |
| 42 private: |
| 43 HMODULE module_; |
| 44 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 45 }; // class ResourceLoader |
| 46 |
| 47 } // namespace upgrade_test |
| 48 |
| 49 #endif // CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_ |
OLD | NEW |