Hi,
I recently had a problem when, running under the debugger (thus with HEAP
checking enabled under w2k), I suddenly started to get debug breakpoint
exceptions when stopping my program. Also, the message ‘Heap[X.EXE]: Free
heap block modified at XXX after it was freed’, showed up.
I found out that the memory are referred to was my I/O buffer used for
reading data from the serial port in overlapped mode, which was run in a
separate thread. And, Yes, I did free the buffer before closing the device
. So I added a call to CancelIo, which I believed should have solved
the problem.
The ‘funny’ thing was - now it only occured when no data ever arrived at the
serial port. The reason for this I also found out - the initial read on the
device was queued from another context than the one of the worker thread,
and as CancelIo was always called from within the worker thread I still had
the fault for this particular case.
Now to my real question - who touches my data buffer for the pending I/O
request when closing the device? And why?
Gosh - writing this I suddenly realize that my data buffer wasn’t touched -
it must have been the OVERLAPPED struct … well, having written all this I
might as well post it. Am I right or …
// Johan
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com