Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hooklib/src/main/cpp/casts/cast_art_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ namespace SandHook {
class CastDexMethodIndex : public IMember<art::mirror::ArtMethod, uint32_t> {
protected:
Size calOffset(JNIEnv *jniEnv, art::mirror::ArtMethod *p) override {
if (SDK_INT >= ANDROID_S) {
return CastArtMethod::accessFlag->getOffset()
+ CastArtMethod::accessFlag->size();
}
if (SDK_INT >= ANDROID_P) {
return CastArtMethod::accessFlag->getOffset()
+ CastArtMethod::accessFlag->size()
Expand Down
1 change: 1 addition & 0 deletions hooklib/src/main/cpp/includes/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ static void clearCacheArm32(char* begin, char *end)
#define ANDROID_P 28
#define ANDROID_Q 29
#define ANDROID_R 30
#define ANDROID_S 31

#endif //SANDHOOK_ARCH_H
13 changes: 11 additions & 2 deletions hooklib/src/main/cpp/utils/hide_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,19 @@ extern "C" {

void MakeInitializedClassVisibilyInitialized(void* self){
if(make_initialized_classes_visibly_initialized_) {
size_t OFFSET_classlinker;
#ifdef __LP64__
constexpr size_t OFFSET_classlinker = 472;
if (SDK_INT >= ANDROID_S) {
OFFSET_classlinker = 496;
} else {
OFFSET_classlinker = 472;
}
#else
constexpr size_t OFFSET_classlinker = 276;
if (SDK_INT >= ANDROID_S) {
OFFSET_classlinker = 288;
} else {
OFFSET_classlinker = 276;
}
#endif
void *thiz = *reinterpret_cast<void **>(
reinterpret_cast<size_t>(runtime_instance_) + OFFSET_classlinker);
Expand Down