1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Defines the SwapImportApp class, which implements the command-line
16 : // "swapimport" tool.
17 :
18 : #ifndef SYZYGY_SWAPIMPORT_SWAPIMPORT_APP_H_
19 : #define SYZYGY_SWAPIMPORT_SWAPIMPORT_APP_H_
20 :
21 : #include "base/command_line.h"
22 : #include "base/files/file_path.h"
23 : #include "syzygy/application/application.h"
24 :
25 : namespace swapimport {
26 :
27 : // Implements the "swapimport" command-line application.
28 : //
29 : // Refer to kUsageFormatStr (referenced from SwapImportApp::Usage()) for
30 : // usage information.
31 : class SwapImportApp : public application::AppImplBase {
32 : public:
33 : SwapImportApp()
34 : : application::AppImplBase("SwapImport"),
35 : overwrite_(false),
36 E : verbose_(false) {}
37 :
38 : // @name Implementation of the AppImplBase interface.
39 : // @{
40 : bool ParseCommandLine(const base::CommandLine* command_line);
41 : int Run();
42 : // @}
43 :
44 : protected:
45 : // @name Utility members.
46 : // @{
47 : bool Usage(const base::CommandLine* command_line,
48 : const base::StringPiece& message) const;
49 : // @}
50 :
51 : // @name Implementation of import swapping.
52 : // @{
53 : template <typename PEFileType> int SwapImports();
54 : // @}
55 :
56 : std::string import_name_;
57 : base::FilePath input_image_;
58 : base::FilePath output_image_;
59 : bool overwrite_;
60 : bool verbose_;
61 : bool x64_;
62 : };
63 :
64 : } // namespace swapimport
65 :
66 : #endif // SYZYGY_SWAPIMPORT_SWAPIMPORT_APP_H_
|