forked from google/binexport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry_point.h
More file actions
96 lines (80 loc) · 2.67 KB
/
entry_point.h
File metadata and controls
96 lines (80 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright 2011-2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_ZYNAMICS_BINEXPORT_ENTRY_POINT_H_
#define THIRD_PARTY_ZYNAMICS_BINEXPORT_ENTRY_POINT_H_
#include <string>
#include <vector>
#include "third_party/zynamics/binexport/types.h"
class EntryPoint {
public:
// Possible sources for entry points.
enum class Source {
CODE_FLOW = 0,
CALL_TARGET,
JUMP_ANY,
JUMP_DIRECT,
JUMP_INDIRECT,
JUMP_TABLE,
JUMP_TABLE_BACKWARDS,
ADDRESS_TABLE,
RUNTIME_CALL_TARGET,
FUNCTION_SIGNATURE,
FUNCTION_PROLOGUE,
FUNCTION_PROLOGUE_MODEL,
FUNCTION_CHUNK,
ENTRY_POINT_IMAGE, // Process memory image
ENTRY_POINT_FILE, // Entry point text file
PE64_EXCEPTION_INFO,
MSIL_EXCEPTION_RECORD,
};
EntryPoint(Address address, EntryPoint::Source source);
string SourceToString();
bool IsFunctionPrologue() const {
return source_ == Source::FUNCTION_PROLOGUE ||
source_ == Source::FUNCTION_SIGNATURE ||
source_ == Source::FUNCTION_PROLOGUE_MODEL;
}
bool IsCallTarget() const {
return source_ == Source::CALL_TARGET ||
source_ == Source::RUNTIME_CALL_TARGET;
}
bool IsExternal() const {
return source_ == Source::ENTRY_POINT_IMAGE ||
source_ == Source::ENTRY_POINT_FILE;
}
Address address_;
EntryPoint::Source source_;
};
bool operator<(const EntryPoint& lhs, const EntryPoint& rhs);
bool operator==(const EntryPoint& lhs, const EntryPoint& rhs);
typedef std::vector<EntryPoint> EntryPoints;
class EntryPointAdder {
public:
EntryPointAdder(EntryPointAdder* parent, string name)
: parent_(parent),
entry_points_(parent->entry_points_),
count_(0),
name_(name) {}
EntryPointAdder(EntryPoints* entry_points, string name)
: parent_(nullptr), entry_points_(entry_points), count_(0), name_(name) {}
~EntryPointAdder();
void Add(Address address, EntryPoint::Source source);
EntryPoints* entry_points() { return entry_points_; }
private:
EntryPointAdder* parent_;
EntryPoints* entry_points_;
size_t count_;
string name_;
};
#endif // THIRD_PARTY_ZYNAMICS_BINEXPORT_ENTRY_POINT_H_