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
0f5ddd3b
Commit
0f5ddd3b
authored
Feb 18, 2019
by
swift_gan
Committed by
swift_gan
Feb 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix call origin method
parent
43a453e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
SandHook.java
hooklib/src/main/java/com/swift/sandhook/SandHook.java
+2
-11
No files found.
hooklib/src/main/java/com/swift/sandhook/SandHook.java
View file @
0f5ddd3b
...
...
@@ -131,7 +131,7 @@ public class SandHook {
Log
.
d
(
"SandHook"
,
"method <"
+
entity
.
target
.
toString
()
+
"> hook <"
+
(
res
==
HookMode
.
INLINE
?
"inline"
:
"replacement"
)
+
"> success!"
);
}
public
static
Object
callOriginMethod
(
Member
originMethod
,
Object
thiz
,
Object
[]
args
)
throws
Throwable
{
public
static
Object
callOriginMethod
(
Member
originMethod
,
Object
thiz
,
Object
...
args
)
throws
Throwable
{
HookWrapper
.
HookEntity
hookEntity
=
globalHookEntityMap
.
get
(
originMethod
);
if
(
hookEntity
==
null
||
hookEntity
.
backup
==
null
)
return
null
;
...
...
@@ -140,21 +140,12 @@ public class SandHook {
public
static
Object
callOriginMethod
(
Member
originMethod
,
Method
backupMethod
,
Object
thiz
,
Object
[]
args
)
throws
Throwable
{
backupMethod
.
setAccessible
(
true
);
if
(
args
==
null
)
{
args
=
new
Object
[
0
];
}
final
int
argsSize
=
args
.
length
;
if
(
Modifier
.
isStatic
(
originMethod
.
getModifiers
()))
{
ensureMethodDeclaringClass
(
originMethod
,
backupMethod
);
return
backupMethod
.
invoke
(
null
,
args
);
}
else
{
Object
[]
newArgs
=
new
Object
[
argsSize
+
1
];
newArgs
[
0
]
=
thiz
;
for
(
int
i
=
1
;
i
<
newArgs
.
length
;
i
++)
{
newArgs
[
i
]
=
args
[
i
-
1
];
}
ensureMethodDeclaringClass
(
originMethod
,
backupMethod
);
return
backupMethod
.
invoke
(
null
,
newA
rgs
);
return
backupMethod
.
invoke
(
thiz
,
a
rgs
);
}
}
...
...
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