Skip to content

hook超过一定量的函数会无法hook #114

@350030173

Description

@350030173

ShadowHook Version

2.0.0

Android OS Version

12

Android ABIs

arm64-v8a

Device Manufacturers and Models

红米k40s

Describe the Bug

2026-05-11 12:43:16.496 15369-15465/? E/fuck: Hooked 方法名:MoveNext, 内存地址偏移:0x790c3d67e8, 函数偏移地址:0x790c3d67e8
2026-05-11 12:43:16.496 15369-15465/? E/fuck: Hooked 方法名:System.Collections.Generic.IEnumerator<System.Object>.get_Current, 内存地址偏移:0x790c3d68a4, 函数偏移地址:0x790c3d68a4
2026-05-11 12:43:16.496 15369-15465/? E/fuck: Hooked 方法名:System.Collections.IEnumerator.Reset, 内存地址偏移:0x790c3d68ac, 函数偏移地址:0x790c3d68ac
2026-05-11 12:43:16.496 15369-15465/? E/fuck: Hooked 方法名:System.Collections.IEnumerator.get_Current, 内存地址偏移:0x790c3d68ec, 函数偏移地址:0x790c3d68ec
2026-05-11 12:43:16.497 15369-15465/? E/fuck: Hooked 方法名:get_FacialTexture, 内存地址偏移:0x790b995524, 函数偏移地址:0x790b995524

### 以上差不多有151个函数能hook上,超过这个数就失败了,提示如下:

2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook失败,类名:Player,方法名:get_MissileMove, 内存地址偏移:0x790b995564, 函数偏移地址:0x790b995564
2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook failed, errno=41, msg=Alloc island for enter failed
2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook失败,类名:Player,方法名:get_IsDrillPunch, 内存地址偏移:0x790b99556c, 函数偏移地址:0x790b99556c
2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook failed, errno=41, msg=Alloc island for enter failed
2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook失败,类名:Player,方法名:OnEnable, 内存地址偏移:0x790b995574, 函数偏移地址:0x790b995574
2026-05-11 12:43:16.497 15369-15465/? W/fuck: Hook failed, errno=41, msg=Alloc island for enter failed

### 尝试从那个失败的方法开始hook是可以的,但是超过151个函数就继续失败

### 大致代码如下:

void *stub = shadowhook_intercept_instr_addr(方法指针, attach_回调函数, 函数偏移地址, SHADOWHOOK_INTERCEPT_DEFAULT);
if (stub != NULL)
{
	std::lock_guard<std::mutex> lock(g_map_mutex);
	LOGE("Hooked 方法名:%s, 内存地址偏移:%p, 函数偏移地址:%p", method->name,方法指针, 函数偏移地址);
} else
{
	LOGW("Hook失败,类名:%s,方法名:%s, 内存地址偏移:%p, 函数偏移地址:%p", klass->name,method->name,方法指针, 函数偏移地址);
	int err = shadowhook_get_errno();
	LOGW("Hook failed, errno=%d, msg=%s", err, shadowhook_to_errmsg(err));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions