-
Notifications
You must be signed in to change notification settings - Fork 18
/
base.inc
112 lines (106 loc) · 2.19 KB
/
base.inc
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
; Detect whether we're assembling in 32 or 64 bits
virtual at 0
xchg eax,eax
detected_32bit = $-2
end virtual
include "const.inc"
match =1, MAKE_DLL
{
include 'macro/export.inc'
include 'macro/resource.inc'
include "encoding/utf8.inc"
}
maybe_rva equ
match =1, MAKE_DLL
{
maybe_rva equ rva
}
macro zeroalign value
{
rb (value-1)-(maybe_rva $+value-1) mod value
}
macro palign value
{
if detected_32bit & ~ WOW64
zeroalign 4
else
zeroalign 8
end if
}
macro vkrow VirtualKey, Attributes, wch&
{
db VirtualKey, Attributes
du wch
}
; The following macros are to prevent assembly with missing or extra columns
macro vkrow1 v, a, c1*
{ vkrow v, a, c1 }
macro vkrow2 v, a, c1*, c2*
{ vkrow v, a, c1, c2 }
macro vkrow3 v, a, c1*, c2*, c3*
{ vkrow v, a, c1, c2, c3 }
macro vkrow4 v, a, c1*, c2*, c3*, c4*
{ vkrow v, a, c1, c2, c3, c4 }
macro vkrow5 v, a, c1*, c2*, c3*, c4*, c5*
{ vkrow v, a, c1, c2, c3, c4, c5 }
macro vkrow6 v, a, c1*, c2*, c3*, c4*, c5*, c6*
{ vkrow v, a, c1, c2, c3, c4, c5, c6 }
macro vkrow7 v, a, c1*, c2*, c3*, c4*, c5*, c6*, c7*
{ vkrow v, a, c1, c2, c3, c4, c5, c6, c7 }
macro vkrow8 v, a, c1*, c2*, c3*, c4*, c5*, c6*, c7*, c8*
{ vkrow v, a, c1, c2, c3, c4, c5, c6, c7, c8 }
macro vkrow9 v, a, c1*, c2*, c3*, c4*, c5*, c6*, c7*, c8*, c9*
{ vkrow v, a, c1, c2, c3, c4, c5, c6, c7, c8, c9 }
macro vkrow10 v, a, c1*, c2*, c3*, c4*, c5*, c6*, c7*, c8*, c9*, c10*
{ vkrow v, a, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 }
struc equ! expr
{
rept 1 value:expr
\{
restore .
. equ value
\}
}
stored_strings equ ""
stst_index equ 1
macro dp [v]
{
forward
stst_index equ! stst_index+1
if v eqtype ""
match A,stst_index
\{
if detected_32bit & ~ WOW64
dd stst_\#A
else
dq stst_\#A
end if
\}
stored_strings equ stored_strings,v
else
if detected_32bit & ~ WOW64
dd v
else
dq v
end if
end if
}
macro store_strings
{
stst_index equ 0
match a,stored_strings
\{
irp v,a
\\{
stst_index equ! stst_index+1
match A,stst_index
\\\{
stst_\\\#A:
if v eqtype ""
du v, 0
end if
palign
\\\}
\\}
\}
}