Revert of Add a WinHeap dump provider to the memory profiler. (patchset #2 id:40001...
[chromium-blink-merge.git] / chrome / installer / test / resource_loader.h
blobb43056c42899528db770dbd465eb239b809e73ed
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.
5 // A helper class for loading resources out of portable executable files.
7 #ifndef CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_
8 #define CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_
10 #include <windows.h>
12 #include <string>
13 #include <utility>
15 #include "base/basictypes.h"
17 namespace base {
18 class FilePath;
21 namespace upgrade_test {
23 // Loads resources in a PE image file.
24 class ResourceLoader {
25 public:
26 ResourceLoader();
27 ~ResourceLoader();
29 // Loads |pe_image_path| in preparation for loading its resources.
30 bool Initialize(const base::FilePath& pe_image_path);
32 // 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 // valid only until this instance is destroyed.
35 bool Load(const std::wstring& name, const std::wstring& type,
36 std::pair<const uint8*, DWORD>* resource_data);
38 // 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
40 // valid only until this instance is destroyed.
41 bool Load(WORD id, WORD type, std::pair<const uint8*, DWORD>* resource_data);
43 private:
44 HMODULE module_;
45 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
46 }; // class ResourceLoader
48 } // namespace upgrade_test
50 #endif // CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_