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
134a3f6c
Commit
134a3f6c
authored
Mar 07, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove used code gen
parent
4852ccf9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
29 deletions
+3
-29
HookerDexMakerNew.java
...ft/sandhook/xposedcompat/methodgen/HookerDexMakerNew.java
+3
-29
No files found.
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/HookerDexMakerNew.java
View file @
134a3f6c
...
@@ -5,14 +5,12 @@ import android.text.TextUtils;
...
@@ -5,14 +5,12 @@ import android.text.TextUtils;
import
com.android.dx.Code
;
import
com.android.dx.Code
;
import
com.android.dx.DexMaker
;
import
com.android.dx.DexMaker
;
import
com.android.dx.FieldId
;
import
com.android.dx.FieldId
;
import
com.android.dx.Label
;
import
com.android.dx.Local
;
import
com.android.dx.Local
;
import
com.android.dx.MethodId
;
import
com.android.dx.MethodId
;
import
com.android.dx.TypeId
;
import
com.android.dx.TypeId
;
import
com.swift.sandhook.SandHook
;
import
com.swift.sandhook.SandHook
;
import
com.swift.sandhook.wrapper.HookWrapper
;
import
com.swift.sandhook.wrapper.HookWrapper
;
import
com.swift.sandhook.xposedcompat.hookstub.HookStubManager
;
import
com.swift.sandhook.xposedcompat.hookstub.HookStubManager
;
import
com.swift.sandhook.xposedcompat.utils.DexLog
;
import
java.io.File
;
import
java.io.File
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
...
@@ -40,7 +38,6 @@ public class HookerDexMakerNew implements HookMaker {
...
@@ -40,7 +38,6 @@ public class HookerDexMakerNew implements HookMaker {
private
static
final
String
FIELD_NAME_HOOK_INFO
=
"additionalHookInfo"
;
private
static
final
String
FIELD_NAME_HOOK_INFO
=
"additionalHookInfo"
;
private
static
final
String
FIELD_NAME_METHOD
=
"method"
;
private
static
final
String
FIELD_NAME_METHOD
=
"method"
;
private
static
final
String
FIELD_NAME_BACKUP_METHOD
=
"backupMethod"
;
private
static
final
String
FIELD_NAME_BACKUP_METHOD
=
"backupMethod"
;
private
static
final
TypeId
<
Throwable
>
throwableTypeId
=
TypeId
.
get
(
Throwable
.
class
);
private
static
final
TypeId
<
Member
>
memberTypeId
=
TypeId
.
get
(
Member
.
class
);
private
static
final
TypeId
<
Member
>
memberTypeId
=
TypeId
.
get
(
Member
.
class
);
private
static
final
TypeId
<
Method
>
methodTypeId
=
TypeId
.
get
(
Method
.
class
);
private
static
final
TypeId
<
Method
>
methodTypeId
=
TypeId
.
get
(
Method
.
class
);
private
static
final
TypeId
<
XposedBridge
.
AdditionalHookInfo
>
hookInfoTypeId
private
static
final
TypeId
<
XposedBridge
.
AdditionalHookInfo
>
hookInfoTypeId
...
@@ -183,7 +180,7 @@ public class HookerDexMakerNew implements HookMaker {
...
@@ -183,7 +180,7 @@ public class HookerDexMakerNew implements HookMaker {
mHookClass
=
loader
.
loadClass
(
className
);
mHookClass
=
loader
.
loadClass
(
className
);
// Execute our newly-generated code in-process.
// Execute our newly-generated code in-process.
mHookMethod
=
mHookClass
.
getMethod
(
METHOD_NAME_HOOK
,
mActualParameterTypes
);
mHookMethod
=
mHookClass
.
getMethod
(
METHOD_NAME_HOOK
,
mActualParameterTypes
);
mBackupMethod
=
mHookClass
.
getMethod
(
METHOD_NAME_BACKUP
,
mActualParameterTypes
);
mBackupMethod
=
mHookClass
.
getMethod
(
METHOD_NAME_BACKUP
);
setup
(
mHookClass
);
setup
(
mHookClass
);
return
new
HookWrapper
.
HookEntity
(
mMember
,
mHookMethod
,
mBackupMethod
,
false
);
return
new
HookWrapper
.
HookEntity
(
mMember
,
mHookMethod
,
mBackupMethod
,
false
);
}
}
...
@@ -224,32 +221,9 @@ public class HookerDexMakerNew implements HookMaker {
...
@@ -224,32 +221,9 @@ public class HookerDexMakerNew implements HookMaker {
}
}
private
void
generateBackupMethod
()
{
private
void
generateBackupMethod
()
{
mBackupMethodId
=
mHookerTypeId
.
getMethod
(
mReturnTypeId
,
METHOD_NAME_BACKUP
,
mParameterTypeIds
);
mBackupMethodId
=
mHookerTypeId
.
getMethod
(
TypeId
.
VOID
,
METHOD_NAME_BACKUP
);
Code
code
=
mDexMaker
.
declare
(
mBackupMethodId
,
Modifier
.
PUBLIC
|
Modifier
.
STATIC
);
Code
code
=
mDexMaker
.
declare
(
mBackupMethodId
,
Modifier
.
PUBLIC
|
Modifier
.
STATIC
);
code
.
returnVoid
();
Local
<
Member
>
method
=
code
.
newLocal
(
memberTypeId
);
Map
<
TypeId
,
Local
>
resultLocals
=
createResultLocals
(
code
);
MethodId
<?,
?>
errLogMethod
=
TypeId
.
get
(
DexLog
.
class
).
getMethod
(
TypeId
.
get
(
Void
.
TYPE
),
"printCallOriginError"
,
memberTypeId
);
//very very important!!!!!!!!!!!
//add a try cache block avoid inline
Label
tryCatchBlock
=
new
Label
();
code
.
addCatchClause
(
throwableTypeId
,
tryCatchBlock
);
code
.
sget
(
mMethodFieldId
,
method
);
code
.
invokeStatic
(
errLogMethod
,
null
,
method
);
// start of try
code
.
mark
(
tryCatchBlock
);
// do nothing
if
(
mReturnTypeId
.
equals
(
TypeId
.
VOID
))
{
code
.
returnVoid
();
}
else
{
// we have limited the returnType to primitives or Object, so this should be safe
code
.
returnValue
(
resultLocals
.
get
(
mReturnTypeId
));
}
}
}
private
void
generateHookMethod
()
{
private
void
generateHookMethod
()
{
...
...
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