We are trying to hook C++ member function(non-exported) with following prototype from MSHTML.dll, by using HookCode.
HRESULT CHtmTagStm::WriteTag(DWORD,wchar_t*,ULONG,BOOL);
Hook functions we have tried are:
Code: Select all
HRESULT WINAPI PQR(void*,DWORD,wchar_t*,ULONG,BOOL); // 5 parameters
HRESULT __fastcall PQR(void* ,void*,DWORD,wchar_t*,ULONG,BOOL); // 6 parameters
it throws an ACCESS VIOLATION error. i. e. C0000005
source code of function:
Code: Select all
HRESULT __fastcall PQR(void* r1,void* r2,DWORD x1,wchar_t* x2,ULONG x3,BOOL x4)
{
FILE* fp = fopen("","ab+");
fprintf(fp,"\r\n%s",x2);
fclose(fp);
UnHookCode(r1,r2,x1,x2,x3,x4);
}
How should we determine whats wrong in above code?