Chromium Code Reviews| Index: chrome/installer/test/pe_image_resources.h |
| =================================================================== |
| --- chrome/installer/test/pe_image_resources.h (revision 0) |
| +++ chrome/installer/test/pe_image_resources.h (revision 0) |
| @@ -0,0 +1,63 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This file contains the interface for an iterator over a portable executable |
| +// file's resources. |
| + |
| +#ifndef CHROME_INSTALLER_TEST_PE_IMAGE_RESOURCES_H__ |
|
tommi (sloooow) - chröme
2010/11/19 20:14:38
_
grt (UTC plus 2)
2010/11/22 17:53:29
Done.
|
| +#define CHROME_INSTALLER_TEST_PE_IMAGE_RESOURCES_H__ |
| +#pragma once |
| + |
| +#include <windows.h> |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/logging.h" |
| + |
| +namespace base { namespace win { class PEImage; } } |
| + |
| +namespace upgrade_test { |
| + |
| +// A CopyConstructible and Assignable identifier for resource directory |
| +// entries. |
| +class EntryId { |
| + public: |
| + explicit EntryId(WORD number) : number_(number) { } |
| + explicit EntryId(const std::wstring& name) : name_(name), number_() { |
| + DCHECK_NE(static_cast<std::wstring::size_type>(0), name.size()); |
| + } |
| + bool IsNamed() const { return !name_.empty(); } |
| + WORD number() const { return number_; } |
| + const std::wstring& name() const { return name_; } |
| + private: |
| + std::wstring name_; |
| + WORD number_; |
| +}; // class EntryId |
| + |
| +// A sequence of identifiers comprising the path from the root of an image's |
| +// resource directory to an individual resource. |
| +typedef std::vector<EntryId> EntryPath; |
| + |
| +// A callback function invoked once for each data entry in the image's |
| +// directory of resources. |
| +// |path| - the full path of the data entry, |
| +// |data| - the address of the entry's data. |
| +// |size| - the size, in bytes, of the entry's data. |
| +// |code_page| - the code page to be used to interpret string data in the |
| +// entry's data. |
| +// |context| - the context given to EnumResources. |
| +typedef void (*EnumResource_Fn)(const EntryPath& path, uint8* data, |
| + DWORD size, DWORD code_page, uintptr_t context); |
| + |
| +// Enumerates all data entries in |image|'s resource directory. |function| is |
| +// invoked (and provided with |context|) once per entry. Returns false if |
| +// some or all of the resource directory could not be parsed. |
| +bool EnumResources(const base::win::PEImage& image, EnumResource_Fn function, |
| + uintptr_t context); |
| + |
| +} // namespace upgrade_test |
| + |
| +#endif // CHROME_INSTALLER_TEST_PE_IMAGE_RESOURCES_H__ |
| Property changes on: chrome\installer\test\pe_image_resources.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |