diff options
author | dgarrett@chromium.org <dgarrett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-04 13:43:25 +0000 |
---|---|---|
committer | dgarrett@chromium.org <dgarrett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-04 13:43:25 +0000 |
commit | 14df9e63ee9497eaed402e00cd4f95bfd2630476 (patch) | |
tree | 8d5668dd3313119fc5b6ebf22a089c8559264969 /courgette/courgette_tool.cc | |
parent | 13daae6db93408e08e373f9ca911d371120cfab6 (diff) | |
download | chromium_src-14df9e63ee9497eaed402e00cd4f95bfd2630476.zip chromium_src-14df9e63ee9497eaed402e00cd4f95bfd2630476.tar.gz chromium_src-14df9e63ee9497eaed402e00cd4f95bfd2630476.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/courgette_tool.cc')
-rw-r--r-- | courgette/courgette_tool.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index d36f4f1..6b2e14e 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -85,7 +85,8 @@ void Disassemble(const std::wstring& input_file, courgette::AssemblyProgram* program = NULL; const courgette::Status parse_status = - courgette::ParseWin32X86PE(buffer.c_str(), buffer.length(), &program); + courgette::ParseDetectedExecutable(buffer.c_str(), buffer.length(), + &program); if (parse_status != courgette::C_OK) Problem("Can't parse input."); @@ -122,17 +123,17 @@ void DisassembleAndAdjust(const std::wstring& program_file, courgette::AssemblyProgram* program = NULL; const courgette::Status parse_program_status = - courgette::ParseWin32X86PE(program_buffer.c_str(), - program_buffer.length(), - &program); + courgette::ParseDetectedExecutable(program_buffer.c_str(), + program_buffer.length(), + &program); if (parse_program_status != courgette::C_OK) Problem("Can't parse program input."); courgette::AssemblyProgram* model = NULL; const courgette::Status parse_model_status = - courgette::ParseWin32X86PE(model_buffer.c_str(), - model_buffer.length(), - &model); + courgette::ParseDetectedExecutable(model_buffer.c_str(), + model_buffer.length(), + &model); if (parse_model_status != courgette::C_OK) Problem("Can't parse model input."); @@ -178,17 +179,17 @@ void DisassembleAdjustDiff(const std::wstring& model_file, courgette::AssemblyProgram* model = NULL; const courgette::Status parse_model_status = - courgette::ParseWin32X86PE(model_buffer.c_str(), - model_buffer.length(), - &model); + courgette::ParseDetectedExecutable(model_buffer.c_str(), + model_buffer.length(), + &model); if (parse_model_status != courgette::C_OK) Problem("Can't parse model input."); courgette::AssemblyProgram* program = NULL; const courgette::Status parse_program_status = - courgette::ParseWin32X86PE(program_buffer.c_str(), - program_buffer.length(), - &program); + courgette::ParseDetectedExecutable(program_buffer.c_str(), + program_buffer.length(), + &program); if (parse_program_status != courgette::C_OK) Problem("Can't parse program input."); |