Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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?
Posted
Updated 26-Jan-10 3:06am
v2

This question has been posted once already. Please do not multi-post questions, but wait for an answer.
 
Share this answer
 
Microsoft MSDN explains the
buffer manipulation[^] as well.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900