OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains the code to apply a Courgette patch. | 5 // This file contains the code to apply a Courgette patch. |
6 | 6 |
7 #include "courgette/ensemble.h" | 7 #include "courgette/ensemble.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (!transformation_parameters->ReadVarint32(&kind)) | 135 if (!transformation_parameters->ReadVarint32(&kind)) |
136 return C_BAD_ENSEMBLE_HEADER; | 136 return C_BAD_ENSEMBLE_HEADER; |
137 | 137 |
138 TransformationPatcher* patcher = NULL; | 138 TransformationPatcher* patcher = NULL; |
139 | 139 |
140 switch (kind) | 140 switch (kind) |
141 { | 141 { |
142 case EXE_WIN_32_X86: | 142 case EXE_WIN_32_X86: |
143 patcher = new PatcherX86_32(base_region_); | 143 patcher = new PatcherX86_32(base_region_); |
144 break; | 144 break; |
| 145 case EXE_ELF_32_X86: |
| 146 patcher = new PatcherX86_32(base_region_); |
| 147 break; |
145 } | 148 } |
146 | 149 |
147 if (patcher) | 150 if (patcher) |
148 patchers_.push_back(patcher); | 151 patchers_.push_back(patcher); |
149 else | 152 else |
150 return C_BAD_ENSEMBLE_HEADER; | 153 return C_BAD_ENSEMBLE_HEADER; |
151 } | 154 } |
152 | 155 |
153 for (size_t i = 0; i < patchers_.size(); ++i) { | 156 for (size_t i = 0; i < patchers_.size(); ++i) { |
154 Status status = patchers_[i]->Init(transformation_parameters); | 157 Status status = patchers_[i]->Init(transformation_parameters); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 static_cast<int>(new_sink_stream.Length())); | 416 static_cast<int>(new_sink_stream.Length())); |
414 if (written == -1) | 417 if (written == -1) |
415 return C_WRITE_OPEN_ERROR; | 418 return C_WRITE_OPEN_ERROR; |
416 if (static_cast<size_t>(written) != new_sink_stream.Length()) | 419 if (static_cast<size_t>(written) != new_sink_stream.Length()) |
417 return C_WRITE_ERROR; | 420 return C_WRITE_ERROR; |
418 | 421 |
419 return C_OK; | 422 return C_OK; |
420 } | 423 } |
421 | 424 |
422 } // namespace | 425 } // namespace |
OLD | NEW |