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