[RESENT] Add fileio debugchannel for file content debugging
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sun Jul 10 10:12:57 CDT 2005
Changelog:
wine/dlls/kernel/file.c: (ReadFile/WriteFile)
Add fileio channel for Read/WriteFile spying
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/kernel/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/file.c,v
retrieving revision 1.39
diff -u -r1.39 file.c
--- wine/dlls/kernel/file.c 20 Jun 2005 10:40:37 -0000 1.39
+++ wine/dlls/kernel/file.c 2 Jul 2005 17:27:50 -0000
@@ -46,6 +46,7 @@
#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL(file);
+WINE_DECLARE_DEBUG_CHANNEL(fileio);
HANDLE dos_handles[DOS_TABLE_SIZE];
@@ -377,6 +378,15 @@
if (status != STATUS_PENDING && bytesRead)
*bytesRead = io_status->Information;
+ if (TRACE_ON(fileio) && bytesRead && *bytesRead)
+ {
+ int i;
+ DPRINTF("ReadFile %9ld Bytes from %p: 0x", *bytesRead, hFile);
+ for(i=0; i<*bytesRead && i<20; i++)
+ DPRINTF("%02x",((unsigned char*)buffer)[i]);
+ DPRINTF(" %s\n",debugstr_an((unsigned char*)buffer,(*bytesRead>20)?20:*bytesRead));
+ }
+
if (status && status != STATUS_END_OF_FILE)
{
SetLastError( RtlNtStatusToDosError(status) );
@@ -432,6 +442,15 @@
PIO_STATUS_BLOCK piosb = &iosb;
TRACE("%p %p %ld %p %p\n", hFile, buffer, bytesToWrite, bytesWritten, overlapped );
+
+ if (TRACE_ON(fileio) && bytesToWrite)
+ {
+ int i;
+ DPRINTF("WriteFile %8ld Bytes from %p: 0x", bytesToWrite, hFile);
+ for(i=0; i<bytesToWrite && i<20; i++)
+ DPRINTF("%02x",((unsigned char*)buffer)[i]);
+ DPRINTF(" %s\n",debugstr_an(buffer,(bytesToWrite>20)?20:bytesToWrite));
+ }
if (is_console_handle(hFile))
return WriteConsoleA(hFile, buffer, bytesToWrite, bytesWritten, NULL);
More information about the wine-patches
mailing list