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_
15 #include "base/basictypes.h"
21 namespace upgrade_test
{
23 // Loads resources in a PE image file.
24 class 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
);
45 DISALLOW_COPY_AND_ASSIGN(ResourceLoader
);
46 }; // class ResourceLoader
48 } // namespace upgrade_test
50 #endif // CHROME_INSTALLER_TEST_RESOURCE_LOADER_H_