| 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 #ifndef COURGETTE_COURGETTE_H_ | 5 #ifndef COURGETTE_COURGETTE_H_ |
| 6 #define COURGETTE_COURGETTE_H_ | 6 #define COURGETTE_COURGETTE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> // Required to define size_t on GCC | 8 #include <stddef.h> // Required to define size_t on GCC |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Status ApplyEnsemblePatch(const FilePath::CharType* old_file_name, | 80 Status ApplyEnsemblePatch(const FilePath::CharType* old_file_name, |
| 81 const FilePath::CharType* patch_file_name, | 81 const FilePath::CharType* patch_file_name, |
| 82 const FilePath::CharType* new_file_name); | 82 const FilePath::CharType* new_file_name); |
| 83 | 83 |
| 84 // Generates a patch that will transform the bytes in |old| into the bytes in | 84 // Generates a patch that will transform the bytes in |old| into the bytes in |
| 85 // |target|. | 85 // |target|. |
| 86 // Returns C_OK unless something when wrong (unexpected). | 86 // Returns C_OK unless something when wrong (unexpected). |
| 87 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, | 87 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, |
| 88 SinkStream* patch); | 88 SinkStream* patch); |
| 89 | 89 |
| 90 // Parses a Windows 32-bit 'Portable Executable' format file from memory, | 90 // Detects the type of an executable file, and it's length. The length |
| 91 // storing the pointer to the AssemblyProgram in |*output|. | 91 // may be slightly smaller than some executables (like ELF), but will include |
| 92 // Returns C_OK if successful, otherwise returns an error status and sets | 92 // all bytes the courgette algorithm has special benefit for. |
| 93 // |*output| to NULL. | 93 // On sucess: |
| 94 ExecutableType DetectExecutableType(const void* buffer, size_t length); | 94 // Fill in type and detected_length, and return C_OK. |
| 95 // On failure: |
| 96 // Fill in type with UNKNOWN, detected_length with 0, and |
| 97 // return C_INPUT_NOT_RECOGNIZED |
| 98 Status DetectExecutableType(const void* buffer, size_t length, |
| 99 ExecutableType* type, |
| 100 size_t* detected_length); |
| 95 | 101 |
| 96 // Attempts to detect the type of executable, and parse it with the | 102 // Attempts to detect the type of executable, and parse it with the |
| 97 // appropriate tools, storing the pointer to the AssemblyProgram in |*output|. | 103 // appropriate tools, storing the pointer to the AssemblyProgram in |*output|. |
| 98 // Returns C_OK if successful, otherwise returns an error status and sets | 104 // Returns C_OK if successful, otherwise returns an error status and sets |
| 99 // |*output| to NULL. | 105 // |*output| to NULL. |
| 100 Status ParseDetectedExecutable(const void* buffer, size_t length, | 106 Status ParseDetectedExecutable(const void* buffer, size_t length, |
| 101 AssemblyProgram** output); | 107 AssemblyProgram** output); |
| 102 | 108 |
| 103 // Converts |program| into encoded form, returning it as |*output|. | 109 // Converts |program| into encoded form, returning it as |*output|. |
| 104 // Returns C_OK if succeeded, otherwise returns an error status and | 110 // Returns C_OK if succeeded, otherwise returns an error status and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 | 131 |
| 126 // Used to free an EncodedProgram returned by other APIs. | 132 // Used to free an EncodedProgram returned by other APIs. |
| 127 void DeleteEncodedProgram(EncodedProgram* encoded); | 133 void DeleteEncodedProgram(EncodedProgram* encoded); |
| 128 | 134 |
| 129 // Adjusts |program| to look more like |model|. | 135 // Adjusts |program| to look more like |model|. |
| 130 // | 136 // |
| 131 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); | 137 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); |
| 132 | 138 |
| 133 } // namespace courgette | 139 } // namespace courgette |
| 134 #endif // COURGETTE_COURGETTE_H_ | 140 #endif // COURGETTE_COURGETTE_H_ |
| OLD | NEW |