Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / installer / mini_installer / pe_resource.h
blob288bdfc3f9ab9112f136d0ec888c1c1a017329aa
1 // Copyright (c) 2006-2009 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 #ifndef CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_H_
6 #define CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_H_
8 #include <windows.h>
10 // This class models a windows PE resource. It does not pretend to be a full
11 // API wrapper and it is just concerned with loading it to memory and writing
12 // it to disk. Each resource is unique only in the context of a loaded module,
13 // that is why you need to specify one on each constructor.
14 class PEResource {
15 public:
16 // This ctor takes the handle to the resource and the module where it was
17 // found. Ownership of the resource is transfered to this object.
18 PEResource(HRSRC resource, HMODULE module);
20 // This ctor takes the resource name, the resource type and the module where
21 // to look for the resource. If the resource is found IsValid() returns true.
22 PEResource(const wchar_t* name, const wchar_t* type, HMODULE module);
24 // Returns true if the resource is valid.
25 bool IsValid();
27 // Returns the size in bytes of the resource. Returns zero if the resource is
28 // not valid.
29 size_t Size();
31 // Creates a file in 'path' with a copy of the resource. If the resource can
32 // not be loaded into memory or if it cannot be written to disk it returns
33 // false.
34 bool WriteToDisk(const wchar_t* path);
36 private:
37 HRSRC resource_;
38 HMODULE module_;
41 #endif // CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_H_