1 : // Copyright 2013 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 utility functions for finding the original PE file from a Syzygy
16 : // transformed/instrumented version of it.
17 :
18 : #ifndef SYZYGY_GRINDER_FIND_H_
19 : #define SYZYGY_GRINDER_FIND_H_
20 :
21 : #include "syzygy/pe/find.h"
22 :
23 m : namespace grinder {
24 :
25 : // Determines if @p transformed_pe_path is a Syzygy-transformed version of
26 : // @p original_pe_path.
27 : // @param transformed_pe_path The path of the Syzygy-transformed PE file.
28 : // @param original_pe_path The path of the original non-transformed PE file.
29 : // @returns true if the files both exist and are related,
30 : // false otherwise.
31 m : bool PeFilesAreRelated(const base::FilePath& transformed_pe_path,
32 m : const base::FilePath& original_pe_path);
33 :
34 : // Given a Syzygy-transformed PE file looks for the corresponding original
35 : // PE file. This extracts the metadata from the transformed image and uses that
36 : // as input to pe::FindModuleBySignature (see for details on the search
37 : // strategy).
38 : // @param transformed_pe_path The path of the Syzygy-transformed PE file
39 : // whose untransformed source PE file we are looking for.
40 : // @param search_paths A semi-colon separated list of additional search paths.
41 : // @param original_pe_path Will contain the path to the original PE file if
42 : // found, otherwise will be empty.
43 : // @returns false on error, true otherwise. @p original_pe_path will be
44 : // non-empty if the module was found, otherwise it'll be empty.
45 m : bool FindOriginalPeFile(const base::FilePath& transformed_pe_path,
46 m : base::FilePath* original_pe_path);
47 m : bool FindOriginalPeFile(const base::FilePath& transformed_pe_path,
48 m : const base::StringPiece16& search_paths,
49 m : base::FilePath* original_pe_path);
50 :
51 m : } // namespace grinder
52 :
53 : #endif // SYZYGY_GRINDER_FIND_H_
|