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
032ebf96
Commit
032ebf96
authored
Jan 13, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cal accessFlag offset
parent
1347ca13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
4 deletions
+50
-4
CastArtMethod.h
app/src/main/cpp/casts/CastArtMethod.h
+19
-0
ICast.h
app/src/main/cpp/includes/ICast.h
+4
-4
utils.h
app/src/main/cpp/includes/utils.h
+27
-0
No files found.
app/src/main/cpp/casts/CastArtMethod.h
View file @
032ebf96
...
...
@@ -15,10 +15,25 @@ namespace SandHook {
};
class
CastAccessFlag
:
public
IMember
<
art
::
mirror
::
ArtMethod
,
uint32_t
>
{
protected
:
Size
calOffset
(
art
::
mirror
::
ArtMethod
p
)
override
{
int
offset
=
findOffset
(
&
p
,
getParentSize
(),
sizeof
(
uint32_t
),
524313
);
if
(
offset
<
0
)
throw
0
;
else
return
static_cast
<
size_t
>
(
offset
);
}
};
class
CastArtMethod
{
public
:
static
Size
size
;
static
IMember
<
art
::
mirror
::
ArtMethod
,
void
*>*
entryPointQuickCompiled
;
static
IMember
<
art
::
mirror
::
ArtMethod
,
uint32_t
>*
accessFlag
;
static
void
init
(
JNIEnv
*
env
)
{
//init ArtMethodSize
...
...
@@ -33,11 +48,15 @@ namespace SandHook {
entryPointQuickCompiled
=
new
CastEntryPointQuickCompiled
();
entryPointQuickCompiled
->
init
(
m
,
size
);
accessFlag
=
new
CastAccessFlag
();
accessFlag
->
init
(
m
,
size
);
}
};
Size
CastArtMethod
::
size
=
0
;
IMember
<
art
::
mirror
::
ArtMethod
,
void
*>*
CastArtMethod
::
entryPointQuickCompiled
=
nullptr
;
IMember
<
art
::
mirror
::
ArtMethod
,
uint32_t
>*
CastArtMethod
::
accessFlag
=
nullptr
;
}
...
...
app/src/main/cpp/includes/ICast.h
View file @
032ebf96
...
...
@@ -5,13 +5,11 @@
#include <stdint.h>
#include <string.h>
#include "arch.h"
#include "utils.h"
#ifndef SANDHOOK_ICAST_H
#define SANDHOOK_ICAST_H
#endif //SANDHOOK_ICAST_H
namespace
SandHook
{
template
<
typename
T
>
...
...
@@ -60,4 +58,6 @@ namespace SandHook {
};
}
\ No newline at end of file
}
#endif //SANDHOOK_ICAST_H
\ No newline at end of file
app/src/main/cpp/includes/utils.h
0 → 100644
View file @
032ebf96
//
// Created by 甘尧 on 2019/1/13.
//
#ifndef SANDHOOK_UTILS_H
#define SANDHOOK_UTILS_H
#include <cwchar>
template
<
typename
T
>
int
findOffset
(
void
*
start
,
size_t
len
,
size_t
step
,
T
value
)
{
if
(
NULL
==
start
)
{
return
-
1
;
}
for
(
int
i
=
0
;
i
<=
len
;
i
+=
step
)
{
T
current_value
=
*
reinterpret_cast
<
T
*>
((
size_t
)
start
+
i
);
if
(
value
==
current_value
)
{
return
i
;
}
}
return
-
1
;
}
#endif //SANDHOOK_UTILS_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