阅读:2485回复:2
钩住了ReadFile?(含代码)大侠快来指点![
代码如下,做个全局的钩子ReadFile,下面为回调函数,我想将自己的内容写到Buffer中显示出来,为什么这么写不可以,而且会报Debug异常? 或者出来也是乱码?哪位大侠做过类似的挂接,请指教啊?
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 ) { bool nResult = TRUE; char *m_pBuf= (char *)"zxcvzxcv"; nResult = ((PFNReadFile)(PROC)g_ReadFile)(hFile, m_pBuf, sizeof(m_pBuf), lpNumberOfBytesRead,lpOverlapped); return nResult; } 或者谁能告诉ReadFile回调中应该怎么写?给个思路啊? 感谢!!! |
|
沙发#
发布于:2010-05-02 11:18
读缓冲先,然后在掉系统的ReadFile函数。
晕。 |
|
|
板凳#
发布于:2010-05-02 11:25
谷歌:API Hook。
准会有无数的资料弹出来。 |
|
|