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
5a5f9c34
Commit
5a5f9c34
authored
Jun 01, 2019
by
swift_gan
Committed by
swift_gan
Jun 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]update extern api
parent
d09bebd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
sandhook_native.cpp
nativehook/src/main/cpp/sandhook_native.cpp
+12
-1
sandhook_native.h
nativehook/src/main/cpp/sandhook_native.h
+8
-0
No files found.
nativehook/src/main/cpp/sandhook_native.cpp
View file @
5a5f9c34
...
@@ -136,7 +136,7 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
...
@@ -136,7 +136,7 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
void
*
do3P
=
reinterpret_cast
<
void
*>
(
do3
);
void
*
do3P
=
reinterpret_cast
<
void
*>
(
do3
);
InlineHook
::
instance
->
breakPoint
(
reinterpret_cast
<
void
*>
(
do3
),
breakCallback
);
InlineHook
::
instance
->
breakPoint
(
reinterpret_cast
<
void
*>
(
(
Addr
)
do3
+
16
),
breakCallback
);
LOGE
(
"ok"
);
LOGE
(
"ok"
);
...
@@ -146,6 +146,12 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
...
@@ -146,6 +146,12 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
}
}
extern
"C"
EXPORT
void
*
SandGetSym
(
const
char
*
so
,
const
char
*
symb
)
{
ElfImg
elfImg
(
so
);
return
reinterpret_cast
<
void
*>
(
elfImg
.
getSymbAddress
(
symb
));
}
extern
"C"
extern
"C"
EXPORT
void
*
SandInlineHook
(
void
*
origin
,
void
*
replace
)
{
EXPORT
void
*
SandInlineHook
(
void
*
origin
,
void
*
replace
)
{
return
InlineHook
::
instance
->
inlineHook
(
origin
,
replace
);
return
InlineHook
::
instance
->
inlineHook
(
origin
,
replace
);
...
@@ -159,4 +165,9 @@ EXPORT void* SandInlineHookSym(const char* so, const char* symb, void* replace)
...
@@ -159,4 +165,9 @@ EXPORT void* SandInlineHookSym(const char* so, const char* symb, void* replace)
if
(
origin
==
nullptr
)
if
(
origin
==
nullptr
)
return
nullptr
;
return
nullptr
;
return
InlineHook
::
instance
->
inlineHook
(
origin
,
replace
);
return
InlineHook
::
instance
->
inlineHook
(
origin
,
replace
);
}
extern
"C"
EXPORT
bool
SandBreakpoint
(
void
*
origin
,
void
(
*
callback
)(
REG
[]))
{
return
InlineHook
::
instance
->
breakPoint
(
origin
,
callback
);
}
}
\ No newline at end of file
nativehook/src/main/cpp/sandhook_native.h
View file @
5a5f9c34
...
@@ -5,12 +5,20 @@
...
@@ -5,12 +5,20 @@
#ifndef SANDHOOK_SANDHOOK_NATIVE_H
#ifndef SANDHOOK_SANDHOOK_NATIVE_H
#define SANDHOOK_SANDHOOK_NATIVE_H
#define SANDHOOK_SANDHOOK_NATIVE_H
#include "hook.h"
#define EXPORT __attribute__ ((visibility ("default")))
#define EXPORT __attribute__ ((visibility ("default")))
extern
"C"
EXPORT
void
*
SandGetSym
(
const
char
*
so
,
const
char
*
sym
);
extern
"C"
extern
"C"
EXPORT
void
*
SandInlineHook
(
void
*
origin
,
void
*
replace
);
EXPORT
void
*
SandInlineHook
(
void
*
origin
,
void
*
replace
);
extern
"C"
extern
"C"
EXPORT
void
*
SandInlineHookSym
(
const
char
*
so
,
const
char
*
symb
,
void
*
replace
);
EXPORT
void
*
SandInlineHookSym
(
const
char
*
so
,
const
char
*
symb
,
void
*
replace
);
extern
"C"
EXPORT
bool
SandBreakpoint
(
void
*
origin
,
void
(
*
callback
)(
REG
[]));
#endif //SANDHOOK_SANDHOOK_NATIVE_H
#endif //SANDHOOK_SANDHOOK_NATIVE_H
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