如何挂钩__usercall,__userpurge(__spoils)的功能呢? [英] How to hook __usercall, __userpurge (__spoils) functions?

查看:2273
本文介绍了如何挂钩__usercall,__userpurge(__spoils)的功能呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

认识任何人讲讲挂钩 __ usercall 类型的功能是什么?
我成功地挂钩 __ thiscall __ STDCALL __ CDECL 电话,但此是对我来说足够。

认识任何人挂钩库 __ usercall 的还是如何将这种类型的使用翻译功能勾 __ STDCALL __ CDECL

功能什么,我首先必须挂钩是:

  INT __usercall FUNC< EAX>(INT A< EAX>中INT B< ECX>中诠释三,无符号整型D,符号整数E);


解决方案

使用的包装,将其转换为 __ STDCALL

  INT __stdcall func_hook_payload(int类型的,INT B,INT C,无符号整型D,符号整数E);//包装器
// INT __usercall FUNC<&EAX GT;(INT A< EAX>中INT B< ECX>中诠释三,无符号整型D,符号整数E);
__declspec(裸体)无效func_hook()
{{__asm
    推EBP
    MOV EBP,ESP
    推DWORD PTR [EBP +的0x0C] //或只是推送
    推DWORD PTR [EBP + 0×08] //ð
    推DWORD PTR [EBP + 0×04] // C
    推ECX // B
    推EAX //一
    电话func_hook_payload
    离开
    RET //注意:__usercall是的cdecl样
}}

Know anybody something about hooking __usercall type of functions? I hooking successfully __thiscall, __stdcall and __cdecl calls but this is enough for me.

Know anybody hooking library for __usercall's or how to hook this type of functions using translation to __stdcall or __cdecl?

Function what i must hook at first is:

int __usercall func<eax>(int a<eax>, int b<ecx>, int c, unsigned int d, signed int e);

解决方案

Use a wrapper which will convert it to __stdcall.

int __stdcall func_hook_payload(int a, int b, int c, unsigned int d, signed int e);

// Wrapper for
// int __usercall func<eax>(int a<eax>, int b<ecx>, int c, unsigned int d, signed int e);
__declspec(naked) void func_hook()
{__asm{
    push ebp
    mov ebp, esp
    push dword ptr[ebp + 0x0C] // or just push e
    push dword ptr[ebp + 0x08] // d
    push dword ptr[ebp + 0x04] // c
    push ecx // b
    push eax // a
    call func_hook_payload
    leave
    ret // note: __usercall is cdecl-like
}}

这篇关于如何挂钩__usercall,__userpurge(__spoils)的功能呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆