我已使用我的自定义函数 GetUsbDevicesNameEnum()
MYGetUsbDevicesNameEnum()
我的钩子函数会被触发,但函数的参数没有正确初始化。
我期待 sname =" 123456765-1234I086346"和 sprop =" MORPHO设备",但我得到 sname=NULL and sprop=""
可能是什么问题?
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
}