Example #1
0
BOOL __stdcall APIHook_WriteFile( 
    LPVOID hFile,
    LPVOID lpBuffer,
    unsigned long int nNumberOfBytesToWrite,
    unsigned long int * lpNumberOfBytesWritten,
    LPOVERLAPPED lpOverlapped)
{
    BOOL result = WriteFile (
        hFile,
        lpBuffer,
        nNumberOfBytesToWrite,
        lpNumberOfBytesWritten,
        lpOverlapped);

	Files::iterator it = files.find(hFile);
	if(it != files.end())
	{
		logger.write(it->second, result == TRUE ? "WriteFile OK" : "WriteFile ERROR", lpBuffer, nNumberOfBytesToWrite);
	}
    return result;
}
Example #2
0
BOOL __stdcall APIHook_ReadFile( 
    LPVOID hFile,
    LPVOID lpBuffer,
    unsigned long int nNumberOfBytesToRead,
    unsigned long int * lpNumberOfBytesRead,
    LPOVERLAPPED lpOverlapped)
{
    BOOL result = ReadFile (
        hFile,
        lpBuffer,
        nNumberOfBytesToRead,
        lpNumberOfBytesRead,
        lpOverlapped);

	Files::iterator it = files.find(hFile);
	if(result == TRUE && it != files.end())
	{
		logger.write(it->second, "ReadFile", lpBuffer, *lpNumberOfBytesRead);
	}
    return result;
}