Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / installer / test / resource_updater.h
blob6d6bb9fb5fb02264dc29e40e3f29b0f5c3533315
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 updating resources in portable executable files.
7 #ifndef CHROME_INSTALLER_TEST_RESOURCE_UPDATER_H_
8 #define CHROME_INSTALLER_TEST_RESOURCE_UPDATER_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 // Updates resources in a PE image file.
24 class ResourceUpdater {
25 public:
26 ResourceUpdater();
27 ~ResourceUpdater();
29 // Loads |pe_image_path| in preparation for updating its resources.
30 bool Initialize(const base::FilePath& pe_image_path);
32 // Replaces the contents of the resource |name| of |type| and |language_id|
33 // with the contents of |input_file|, returning true on success.
34 bool Update(const std::wstring& name, const std::wstring& type,
35 WORD language_id, const base::FilePath& input_file);
37 // Commits all updates to the file on disk.
38 bool Commit();
40 private:
41 HANDLE handle_;
42 DISALLOW_COPY_AND_ASSIGN(ResourceUpdater);
43 }; // class ResourceUpdater
45 } // namespace upgrade_test
47 #endif // CHROME_INSTALLER_TEST_RESOURCE_UPDATER_H_