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
75c42e7f
Commit
75c42e7f
authored
Feb 17, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid inline when call origin
parent
feeab481
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
2 deletions
+20
-2
XposedCompat.java
...in/java/com/swift/sandhook/xposedcompat/XposedCompat.java
+2
-1
DynamicBridge.java
.../swift/sandhook/xposedcompat/methodgen/DynamicBridge.java
+3
-1
HookerDexMaker.java
...swift/sandhook/xposedcompat/methodgen/HookerDexMaker.java
+7
-0
DexLog.java
...in/java/com/swift/sandhook/xposedcompat/utils/DexLog.java
+8
-0
No files found.
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/XposedCompat.java
View file @
75c42e7f
...
@@ -6,6 +6,7 @@ import android.content.Context;
...
@@ -6,6 +6,7 @@ import android.content.Context;
import
com.swift.sandhook.xposedcompat.classloaders.ComposeClassLoader
;
import
com.swift.sandhook.xposedcompat.classloaders.ComposeClassLoader
;
import
com.swift.sandhook.xposedcompat.methodgen.DynamicBridge
;
import
com.swift.sandhook.xposedcompat.methodgen.DynamicBridge
;
import
com.swift.sandhook.xposedcompat.utils.ApplicationUtils
;
import
com.swift.sandhook.xposedcompat.utils.ApplicationUtils
;
import
com.swift.sandhook.xposedcompat.utils.FileUtils
;
import
com.swift.sandhook.xposedcompat.utils.ProcessUtils
;
import
com.swift.sandhook.xposedcompat.utils.ProcessUtils
;
import
java.io.File
;
import
java.io.File
;
...
@@ -75,7 +76,7 @@ public class XposedCompat {
...
@@ -75,7 +76,7 @@ public class XposedCompat {
public
static
boolean
clearCache
()
{
public
static
boolean
clearCache
()
{
try
{
try
{
cacheDir
.
delete
(
);
FileUtils
.
delete
(
cacheDir
);
cacheDir
.
mkdirs
();
cacheDir
.
mkdirs
();
return
true
;
return
true
;
}
catch
(
Throwable
throwable
)
{
}
catch
(
Throwable
throwable
)
{
...
...
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/DynamicBridge.java
View file @
75c42e7f
...
@@ -4,6 +4,7 @@ import android.os.Trace;
...
@@ -4,6 +4,7 @@ import android.os.Trace;
import
com.swift.sandhook.xposedcompat.XposedCompat
;
import
com.swift.sandhook.xposedcompat.XposedCompat
;
import
com.swift.sandhook.xposedcompat.utils.DexLog
;
import
com.swift.sandhook.xposedcompat.utils.DexLog
;
import
com.swift.sandhook.xposedcompat.utils.FileUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
...
@@ -71,7 +72,8 @@ public final class DynamicBridge {
...
@@ -71,7 +72,8 @@ public final class DynamicBridge {
if
(!
dexOatDir
.
exists
())
if
(!
dexOatDir
.
exists
())
return
;
return
;
try
{
try
{
dexOatDir
.
delete
();
FileUtils
.
delete
(
dexOatDir
);
dexOatDir
.
mkdirs
();
}
catch
(
Throwable
throwable
)
{
}
catch
(
Throwable
throwable
)
{
}
}
}
}
...
...
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/HookerDexMaker.java
View file @
75c42e7f
...
@@ -267,11 +267,18 @@ public class HookerDexMaker {
...
@@ -267,11 +267,18 @@ public class HookerDexMaker {
private
void
generateBackupMethod
()
{
private
void
generateBackupMethod
()
{
mBackupMethodId
=
mHookerTypeId
.
getMethod
(
mReturnTypeId
,
METHOD_NAME_BACKUP
,
mParameterTypeIds
);
mBackupMethodId
=
mHookerTypeId
.
getMethod
(
mReturnTypeId
,
METHOD_NAME_BACKUP
,
mParameterTypeIds
);
Code
code
=
mDexMaker
.
declare
(
mBackupMethodId
,
Modifier
.
PUBLIC
|
Modifier
.
STATIC
);
Code
code
=
mDexMaker
.
declare
(
mBackupMethodId
,
Modifier
.
PUBLIC
|
Modifier
.
STATIC
);
Local
<
Member
>
method
=
code
.
newLocal
(
memberTypeId
);
Map
<
TypeId
,
Local
>
resultLocals
=
createResultLocals
(
code
);
Map
<
TypeId
,
Local
>
resultLocals
=
createResultLocals
(
code
);
MethodId
<?,
?>
errLogMethod
=
TypeId
.
get
(
DexLog
.
class
).
getMethod
(
TypeId
.
get
(
Void
.
TYPE
),
"printCallOriginError"
,
TypeId
.
get
(
Member
.
class
));
//very very important!!!!!!!!!!!
//add a try cache block avoid inline
//add a try cache block avoid inline
Label
tryCatchBlock
=
new
Label
();
Label
tryCatchBlock
=
new
Label
();
code
.
sget
(
mMethodFieldId
,
method
);
code
.
invokeStatic
(
errLogMethod
,
null
,
method
);
// start of try
// start of try
code
.
addCatchClause
(
throwableTypeId
,
tryCatchBlock
);
code
.
addCatchClause
(
throwableTypeId
,
tryCatchBlock
);
...
...
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/utils/DexLog.java
View file @
75c42e7f
...
@@ -29,6 +29,12 @@ public class DexLog {
...
@@ -29,6 +29,12 @@ public class DexLog {
}
}
}
}
public
static
void
printCallOriginError
(
Member
member
)
{
if
(
member
!=
null
)
{
Log
.
e
(
"SandHook-Xposed"
,
"method <"
+
member
.
toString
()
+
"> call origin error!"
);
}
}
public
static
int
w
(
String
s
)
{
public
static
int
w
(
String
s
)
{
return
Log
.
w
(
TAG
,
s
);
return
Log
.
w
(
TAG
,
s
);
}
}
...
@@ -40,4 +46,6 @@ public class DexLog {
...
@@ -40,4 +46,6 @@ public class DexLog {
public
static
int
e
(
String
s
,
Throwable
t
)
{
public
static
int
e
(
String
s
,
Throwable
t
)
{
return
Log
.
e
(
TAG
,
s
,
t
);
return
Log
.
e
(
TAG
,
s
,
t
);
}
}
}
}
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