1 : // Copyright 2012 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 : // Declares a BlockGraphTransform that trims the DOS header and ensures the NT
16 : // headers are sufficiently big to represent all sections in the block graph.
17 : // To be applied before layout so that the layout remains valid after
18 : // finalizing the headers.
19 : //
20 : // After this transform both the DOS header and the NT headers have been sized
21 : // appropriately for the resulting image. The DOS header has also been finalized
22 : // and will be valid after the transform. The NT headers are not necessarily
23 : // valid.
24 :
25 : #ifndef SYZYGY_PE_TRANSFORMS_PREPARE_HEADERS_TRANSFORM_H_
26 : #define SYZYGY_PE_TRANSFORMS_PREPARE_HEADERS_TRANSFORM_H_
27 :
28 : #include "syzygy/block_graph/transforms/named_transform.h"
29 :
30 m : namespace pe {
31 m : namespace transforms {
32 :
33 m : class PrepareHeadersTransform
34 m : : public block_graph::transforms::NamedBlockGraphTransformImpl<
35 m : PrepareHeadersTransform> {
36 m : public:
37 m : typedef block_graph::BlockGraph BlockGraph;
38 :
39 : // Applies this transform to the provided PE image block graph.
40 : //
41 : // @param block_graph The block graph to transform.
42 : // @param dos_header_block The DOS header block of the block graph.
43 : // @returns true on success, false otherwise.
44 m : virtual bool TransformBlockGraph(
45 m : BlockGraph* block_graph, BlockGraph::Block* dos_header_block) OVERRIDE;
46 :
47 : // The name of this transform.
48 m : static const char kTransformName[];
49 m : };
50 :
51 m : } // namespace transforms
52 m : } // namespace pe
53 :
54 : #endif // SYZYGY_PE_TRANSFORMS_PREPARE_HEADERS_TRANSFORM_H_
|