Walkthrough the stack.
31{
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 if (ReturnAddress[-7] == 0x9A)
49 {
50 *IndexOfCallFromReturnAddress = 7;
52 }
53
54 else if (ReturnAddress[-5] == 0xE8)
55 {
56 *IndexOfCallFromReturnAddress = 5;
58 }
59 else
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
97
98
99
100
101 const unsigned char RmMask = 0xF8;
102
103
104
105
106 if (ReturnAddress[-7] == 0xFF &&
107 (ReturnAddress[-6] == 0x94 || ReturnAddress[-6] == 0x9C))
108 {
109 *IndexOfCallFromReturnAddress = 7;
111 }
112
113
114
115
116
117 else if (ReturnAddress[-6] == 0xFF &&
118 ((ReturnAddress[-5] & RmMask) == 0x90 || (ReturnAddress[-5] & RmMask) == 0x98) &&
119 (ReturnAddress[-5] != 0x94 && ReturnAddress[-5] != 0x9C))
120 {
121 *IndexOfCallFromReturnAddress = 6;
123 }
124
125
126
127
128 else if (ReturnAddress[-6] == 0xFF &&
129 (ReturnAddress[-5] == 0x15 || ReturnAddress[-5] == 0x1D))
130 {
131 *IndexOfCallFromReturnAddress = 6;
133 }
134
135
136
137
138
139 else if (ReturnAddress[-4] == 0xFF &&
140 (ReturnAddress[-3] == 0x54 || ReturnAddress[-3] == 0x5C))
141 {
142 *IndexOfCallFromReturnAddress = 4;
144 }
145
146
147
148
149
150 else if (ReturnAddress[-3] == 0xFF &&
151 ((ReturnAddress[-2] & RmMask) == 0x50 || (ReturnAddress[-2] & RmMask) == 0x58) &&
152 (ReturnAddress[-2] != 0x54 && ReturnAddress[-2] != 0x5C))
153 {
154 *IndexOfCallFromReturnAddress = 3;
156 }
157
158
159
160
161
162 else if (ReturnAddress[-3] == 0xFF &&
163 (ReturnAddress[-2] == 0x14 || ReturnAddress[-2] == 0x1C))
164 {
165 *IndexOfCallFromReturnAddress = 3;
167 }
168
169
170
171
172
173 else if (ReturnAddress[-2] == 0xFF &&
174 ((ReturnAddress[-1] & RmMask) == 0xD0 || (ReturnAddress[-1] & RmMask) == 0xD8))
175 {
176 *IndexOfCallFromReturnAddress = 2;
178 }
179
180
181
182
183
184 else if (ReturnAddress[-2] == 0xFF &&
185 ((ReturnAddress[-1] & RmMask) == 0x10 || (ReturnAddress[-1] & RmMask) == 0x18) &&
186 (ReturnAddress[-1] != 0x14 && ReturnAddress[-1] != 0x15 &&
187 ReturnAddress[-1] != 0x1C && ReturnAddress[-1] != 0x1D))
188 {
189 *IndexOfCallFromReturnAddress = 2;
191 }
192 else
193 {
195 }
196 }
197
199}
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54