-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetSection.wds
48 lines (44 loc) · 1.13 KB
/
GetSection.wds
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
aS /b /x ${/v:SearchAddr} ${$arg1}
.catch {
.printf "Address: ${SearchAddr}\n"
r $t19=1000
.foreach (tok {lma ${SearchAddr}}) {
.if $scmp("${tok}", "start") == 0 {
r $t19=0
}
.elsif @$t19 == 4 {
r $t18=${tok};
}
.elsif @$t19 == 6 {
aS ${/v:SearchImageName} ${tok};
.break;
}
r $t19=@$t19+1
}
r $t17 = ${SearchAddr} - $t18
r $t19=1000
.foreach (tok {!dh @$t18}) {
.if $scmp("${tok}", "SECTION") == 0 {
r $t19=0
}
.elsif @$t19 == 1 and $scmp("${tok}", "HEADER") != 0 {
r $t19 = 1000
}
.elsif @$t19 == 3 {
aS ${/v:SectionName} ${tok}
}
.elsif @$t19 == 5 {
r $t18 = ${tok}
}
.elsif @$t19 == 8 {
.if @$t17 < ${tok} + @$t18 {
r $t16 = @$t17 - ${tok}
.printf "Image:${SearchImageName}\nSection:${SectionName}\nRva:%x\nSecRva:%x\n", @$t17, @$t16
.break;
}
}
r $t19 = @$t19 + 1
}
}
ad SearchImageName
ad SectionName