如何挂钩Readfile,帮帮我!重新发布 [英] How to Hook Readfile,help me! REPOST

查看:129
本文介绍了如何挂钩Readfile,帮帮我!重新发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是回调函数:

The following is a callback function:

CAPIHook g_ReadFile; //the main object of CAPIHook! 
typedef bool (WINAPI *PFNReadFile)( 
__in          HANDLE hFile, 
__out        LPVOID lpBuffer, 
__in          DWORD nNumberOfBytesToRea 
  __out        LPDWORD lpNumberOfBytesRead 
  __in          LPOVERLAPPED lpOverlapped  ); 
bool WINAPI MyReadFile(  
  __in          HANDLE hFile, 
  __out        LPVOID lpBuffer, 
  __in          DWORD nNumberOfBytesToRead, 
  __out        LPDWORD lpNumberOfBytesRead, 
  __in          LPOVERLAPPED lpOverlapped    ) 
{ 
char * m_pBuf = (char *)"zxcvzxcv";  //The problem is here, how to write my own data into the Buffer, displayed it out?
DWORD len = 0;
nResult = ((PFNReadFile)(PROC)g_ReadFile)(hFile, m_pBuf, strlen(m_pBuf), &len, NULL); 
return nResult; 
} 







This will produce garbage!How to modify?

推荐答案

此问题已发布一次.请不要多发布问题,而要等待答案.
This question has been posted once already. Please do not multi-post questions, but wait for an answer.


Microsoft MSDN解释了
缓冲区操作 [
Microsoft MSDN explains the
buffer manipulation[^] as well.


这篇关于如何挂钩Readfile,帮帮我!重新发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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