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
5b8585d4
Commit
5b8585d4
authored
Mar 25, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable useless reset declaring class
parent
bc670453
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
SandHook.java
hooklib/src/main/java/com/swift/sandhook/SandHook.java
+9
-5
HookWrapper.java
...src/main/java/com/swift/sandhook/wrapper/HookWrapper.java
+1
-0
No files found.
hooklib/src/main/java/com/swift/sandhook/SandHook.java
View file @
5b8585d4
...
...
@@ -138,21 +138,25 @@ public class SandHook {
HookWrapper
.
HookEntity
hookEntity
=
globalHookEntityMap
.
get
(
originMethod
);
if
(
hookEntity
==
null
||
hookEntity
.
backup
==
null
)
return
null
;
return
callOriginMethod
(
originMethod
,
hookEntity
.
backup
,
thiz
,
args
);
return
callOriginMethod
(
hookEntity
.
backupIsStub
,
originMethod
,
hookEntity
.
backup
,
thiz
,
args
);
}
public
static
Object
callOriginByBackup
(
Method
backupMethod
,
Object
thiz
,
Object
...
args
)
throws
Throwable
{
HookWrapper
.
HookEntity
hookEntity
=
globalBackupMap
.
get
(
backupMethod
);
if
(
hookEntity
==
null
)
return
null
;
return
callOriginMethod
(
hookEntity
.
target
,
backupMethod
,
thiz
,
args
);
return
callOriginMethod
(
hookEntity
.
backupIsStub
,
hookEntity
.
target
,
backupMethod
,
thiz
,
args
);
}
public
static
Object
callOriginMethod
(
Member
originMethod
,
Method
backupMethod
,
Object
thiz
,
Object
[]
args
)
throws
Throwable
{
//holder in stack to avoid moving gc
Class
originClassHolder
=
originMethod
.
getDeclaringClass
();
return
callOriginMethod
(
false
,
originMethod
,
backupMethod
,
thiz
,
args
);
}
public
static
Object
callOriginMethod
(
boolean
backupIsStub
,
Member
originMethod
,
Method
backupMethod
,
Object
thiz
,
Object
[]
args
)
throws
Throwable
{
//reset declaring class
if
(
SandHookConfig
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(!
backupIsStub
&&
SandHookConfig
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
//holder in stack to avoid moving gc
Class
originClassHolder
=
originMethod
.
getDeclaringClass
();
ensureDeclareClass
(
originMethod
,
backupMethod
);
}
if
(
Modifier
.
isStatic
(
originMethod
.
getModifiers
()))
{
...
...
hooklib/src/main/java/com/swift/sandhook/wrapper/HookWrapper.java
View file @
5b8585d4
...
...
@@ -405,6 +405,7 @@ public class HookWrapper {
public
boolean
hookIsStub
=
false
;
public
boolean
resolveDexCache
=
true
;
public
boolean
backupIsStub
=
true
;
public
Class
[]
pars
;
public
int
hookMode
;
...
...
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