Skip to content

Commit

Permalink
Return bytes not chars for WriteFileA
Browse files Browse the repository at this point in the history
  • Loading branch information
adoxa committed Nov 13, 2010
1 parent b66d378 commit 912a68b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ANSI.c
Expand Up @@ -1154,11 +1154,18 @@ WINAPI MyWriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
DWORD Mode;
if (GetConsoleMode( hFile, &Mode ) && (Mode & ENABLE_PROCESSED_OUTPUT))
{
TCHAR name[MAX_PATH];
DWORD len;
BOOL rc;
DEBUGSTR( TEXT("\\WriteFile: %lu \"%.*hs\""), nNumberOfBytesToWrite, nNumberOfBytesToWrite, lpBuffer );
return MyWriteConsoleA( hFile, lpBuffer,
nNumberOfBytesToWrite,
lpNumberOfBytesWritten,
lpOverlapped );
rc = MyWriteConsoleA( hFile, lpBuffer,
nNumberOfBytesToWrite,
lpNumberOfBytesWritten,
lpOverlapped );
len = GetModuleFileName( NULL, name, lenof(name) );
if (len >= 8 && lstrcmpi( name + len - 8, TEXT("ruby.exe") ) == 0)
*lpNumberOfBytesWritten = nNumberOfBytesToWrite;
return rc;
}
else // here, WriteFile is the old function (this module is not hooked)
{
Expand Down

0 comments on commit 912a68b

Please sign in to comment.