挂钩类的公共成员函数(C_MORPHO_Device)

时间:2017-10-05 13:56:59

标签: c++ hook

我已使用我的自定义函数 GetUsbDevicesNameEnum()

连接函数 MYGetUsbDevicesNameEnum()

我的钩子函数会被触发,但函数的参数没有正确初始化。

我期待 sname =" 123456765-1234I086346"和 sprop =" MORPHO设备",但我得到 sname=NULL and sprop=""

可能是什么问题?

enter image description here

DLL导出

==================================================
Function Name     : const C_MORPHO_Device::`vftable'
Address           : 0x0000000180097148
Relative Address  : 0x00097148
Type              : Exported Function
==================================================

==================================================
Function Name     : public: int __cdecl C_MORPHO_Device::GetUsbDevicesNameEnum(unsigned long,char * __ptr64 & __ptr64,char * __ptr64 & __ptr64) __ptr64
Address           : 0x0000000180011f50
Relative Address  : 0x00011f50
Type              : Exported Function
==================================================

myhook.h

// hooked function typedefs
typedef INT(__cdecl* morpho_GetUsbDevicesNameEnum)(unsigned long, char * __ptr64 , char * __ptr64 );
extern "C" morpho_GetUsbDevicesNameEnum hook_GetUsbDevicesNameEnum= (INT(__cdecl*) (__in unsigned long,  char * __ptr64 , char * __ptr64 ))

....

myhook.cpp

 int main()
 {
  ... 
       // using mhook
       if (Mhook_SetHook((PVOID*)&hook_GetUsbDevicesNameEnum, MYGetUsbDevicesNameEnum))
       { // hook success}
  ...
 }

// my hook function
ULONG WINAPI MYGetUsbDevicesNameEnum(
unsigned long a,   // __in
char * __ptr64  sname,   // _out
char * __ptr64  sprop)   // _out
{
     // we are here but variables are not initialised properly
}

0 个答案:

没有答案