summaryrefslogtreecommitdiffstats
path: root/courgette/ensemble.h
diff options
context:
space:
mode:
authorlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:35:37 +0000
committerlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:35:37 +0000
commitd244fdff5fbbda333ea904b7833b81dddc14ba3b (patch)
tree761ff3d72f842d729fb135aef08b7d686488c107 /courgette/ensemble.h
parent3bbf1ca56cbc84e9dbe08c20ad62521655e12cd1 (diff)
downloadchromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.zip
chromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.tar.gz
chromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.tar.bz2
Revert 103879 - Start refactoring to reduce executable type knowledge.
This creates executable detection functions, a globally shared enum for describing an executable type, and reduces the number of classes and locations with executable specific knowledge. These changes, along with moving architecture specific classes into their own files should make it easier to produce special purpose clients that only contain the code required to apply their own form of patch. DisassemblerWin32EXE, ImagePE, CourgetteWin32X86PatchGenerator, and CourgetteWin32X86Patcher, and ensemble handling are all heavily affected here. This should have no effect on the behavior of the system yet, and is instead all prep-work. BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/7920004 TBR=dgarrett@chromium.org Review URL: http://codereview.chromium.org/8234012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/ensemble.h')
-rw-r--r--courgette/ensemble.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/courgette/ensemble.h b/courgette/ensemble.h
index e766782..f907f9d 100644
--- a/courgette/ensemble.h
+++ b/courgette/ensemble.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -36,14 +36,11 @@ class PEInfo;
//
class Element {
public:
- Element(ExecutableType kind,
- Ensemble* ensemble,
- const Region& region,
- PEInfo*info);
+ enum Kind { WIN32_X86_WITH_CODE, WIN32_NOCODE };
- virtual ~Element();
+ virtual ~Element() {}
- ExecutableType kind() const { return kind_; }
+ Kind kind() const { return kind_; }
const Region& region() const { return region_; }
// The name is used only for debugging and logging.
@@ -53,14 +50,16 @@ class Element {
// containing Ensemble.
size_t offset_in_ensemble() const;
- // The ImageInfo for this executable
- virtual PEInfo* GetImageInfo() const { return info_; }
+ // Some subclasses of Element might have a PEInfo.
+ virtual PEInfo* GetPEInfo() const { return NULL; }
+
+ protected:
+ Element(Kind kind, Ensemble* ensemble, const Region& region);
private:
- ExecutableType kind_;
+ Kind kind_;
Ensemble* ensemble_;
Region region_;
- PEInfo *info_;
DISALLOW_COPY_AND_ASSIGN(Element);
};
@@ -140,8 +139,7 @@ struct CourgettePatchFile {
static const uint32 kVersion = 20110216;
- // Transformation method IDs. These are embedded in generated files, so
- // never remove or change an existing id.
+ // Transformation method IDs.
enum TransformationMethodId {
T_COURGETTE_WIN32_X86 = 1, // Windows 32 bit 'Portable Executable' x86.
};