You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// short jumps can go forward and backward depending on the size of the second byte.
124
+
// if the second byte is below 128, the jmp goes forwards.
125
+
// if the second byte is above 128, the jmp goes backwards ( subtract two's complement of the relative offset from the address of the next instruction ).
126
+
if( r < 128 )
127
+
out = ( out + 1 ) + r;
128
+
else
129
+
out = ( out + 1 ) - ( uint8_t )( ~r + 1 );
130
+
131
+
return ( t )out;
132
+
}
133
+
134
+
template< typename t = Address >
135
+
__forceinline t rel32( size_t offset ) {
136
+
uintptr_t out;
137
+
uint32_t r;
138
+
139
+
if( !m_addr )
140
+
return t{};
141
+
142
+
out = m_addr + offset;
143
+
144
+
// get rel32 offset.
145
+
r = *( uint32_t * )out;
146
+
if( !r )
147
+
return t{};
148
+
149
+
// relative to address of next instruction.
150
+
out = ( out + 4 ) + r;
151
+
152
+
return ( t )out;
153
+
}
154
+
155
+
// set.
156
+
template< typename t = uintptr_t > __forceinline voidset( const t &value ) {
157
+
if( !m_addr )
158
+
return;
159
+
160
+
*(t *)m_addr = value;
161
+
}
162
+
163
+
// checks if address is not null and has correct page protection.
0 commit comments