Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
71e2bf79
Commit
71e2bf79
authored
Jun 05, 2019
by
swift_gan
Committed by
swift_gan
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]tweak code
parent
c07a0124
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
hook_arm32.cpp
nativehook/src/main/cpp/archs/arm/arm32/hook/hook_arm32.cpp
+6
-4
No files found.
nativehook/src/main/cpp/archs/arm/arm32/hook/hook_arm32.cpp
View file @
71e2bf79
...
...
@@ -28,6 +28,8 @@ void *InlineHookArm32Android::inlineHook(void *origin, void *replace) {
return
nullptr
;
}
bool
changeMode
=
isThumbCode
((
Addr
)
origin
)
!=
isThumbCode
((
Addr
)
replace
);
void
*
backup
=
nullptr
;
AssemblerA32
assemblerBackup
(
backupBuffer
);
...
...
@@ -37,7 +39,7 @@ void *InlineHookArm32Android::inlineHook(void *origin, void *replace) {
//build inline trampoline
#define __ assemblerInline.
if
(
isThumbCode
((
Addr
)
replace
)
)
{
if
(
!
changeMode
)
{
Label
*
target_addr_label
=
new
Label
();
__
Ldr
(
PC
,
target_addr_label
);
__
Emit
(
target_addr_label
);
...
...
@@ -78,7 +80,7 @@ bool InlineHookArm32Android::breakPoint(void *origin, void (*callback)(REG *)) {
return
false
;
}
bool
c
allbackThumb
=
isThumbCode
((
Addr
)
callback
);
bool
c
hangeMode
=
isThumbCode
((
Addr
)
origin
)
!
=
isThumbCode
((
Addr
)
callback
);
void
*
backup
=
nullptr
;
AssemblerA32
assemblerBackup
(
backupBuffer
);
...
...
@@ -88,7 +90,7 @@ bool InlineHookArm32Android::breakPoint(void *origin, void (*callback)(REG *)) {
//build backup method
CodeRelocateA32
relocate
=
CodeRelocateA32
(
assemblerBackup
);
backup
=
relocate
.
relocate
(
origin
,
c
allbackThumb
?
(
4
*
2
)
:
(
4
*
2
+
2
),
nullptr
);
backup
=
relocate
.
relocate
(
origin
,
c
hangeMode
?
(
4
*
2
+
2
)
:
(
4
*
2
),
nullptr
);
#define __ assemblerBackup.
__
Mov
(
IP
,(
Addr
)
getThumbPC
(
reinterpret_cast
<
void
*>
((
Addr
)
originCode
+
relocate
.
curOffset
)));
__
Bx
(
IP
);
...
...
@@ -102,7 +104,7 @@ bool InlineHookArm32Android::breakPoint(void *origin, void (*callback)(REG *)) {
//build inline trampoline
#define __ assemblerInline.
if
(
callbackThumb
)
{
if
(
!
changeMode
)
{
Label
*
target_addr_label
=
new
Label
();
__
Ldr
(
PC
,
target_addr_label
);
__
Emit
(
target_addr_label
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment