OLD | NEW |
| (Empty) |
1 // Copyright 2016 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. | |
4 | |
5 #ifndef COURGETTE_PROGRAM_DETECTOR_H_ | |
6 #define COURGETTE_PROGRAM_DETECTOR_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "courgette/courgette.h" | |
12 | |
13 namespace courgette { | |
14 | |
15 class AssemblyProgram; | |
16 | |
17 // Detects the type of an executable file, and it's length. The length may be | |
18 // slightly smaller than some executables (like ELF), but will include all bytes | |
19 // the courgette algorithm has special benefit for. | |
20 // On success: | |
21 // Fills in |type| and |detected_length|, and returns C_OK. | |
22 // On failure: | |
23 // Fills in |type| with UNKNOWN, |detected_length| with 0, and returns | |
24 // C_INPUT_NOT_RECOGNIZED. | |
25 Status DetectExecutableType(const void* buffer, | |
26 size_t length, | |
27 ExecutableType* type, | |
28 size_t* detected_length); | |
29 | |
30 // Attempts to detect the type of executable, and parse it with the appropriate | |
31 // tools. | |
32 // On success: | |
33 // Parses the executable into a new AssemblyProgram in |*output|, and returns | |
34 // C_OK. | |
35 // On failure: | |
36 // Returns an error status and assigns |*output| to null. | |
37 Status ParseDetectedExecutable(const void* buffer, | |
38 size_t length, | |
39 scoped_ptr<AssemblyProgram>* output); | |
40 | |
41 } // namespace courgette | |
42 | |
43 #endif // COURGETTE_PROGRAM_DETECTOR_H_ | |
OLD | NEW |