Data Corruption on win98SE when IRP is re-issued in completion routine

Hi,

We have a bulk usb driver. Corrupt data is sent when large amounts of data
(around 2mb) is sent on win98 SE if the IRP is resubmitted in completion
routine to perform subsequent chunks of data transfer as part of the large
data transfer. It works perfectly well on win2k and winxp. The data
corruption happens only when large amounts of data is sent to the device.
I followed the sample code given in Walter Oney’s book “Programming the
Microsoft WDM Ist edition” page 526.

If I change the read/write approach to create multiple subsidiary IRPs and
submit them all at once instead of re-issuing the original IRP with the
next chunk in the completion routine (as in the above case), it works
perfectly well on win98SE and win2k. But there is a bug with this
approach. If the application asks for say 64k of data to read, this
results in 16 (say chunk size 4k) IRPS created and submitted all at once.
If the device sends,say 10 bytes, in sequence, say 2 times, then only the
first two IRPs are completed and rest of them still waiting to receive
more data though it is actually an end of data transfer. Also the data
received will not be in sequence, the second 10 bytes will be at
user_buffer_start_address+4k. Ideally the application read call should
return when the first 10 bytes are received as it is the end of the data
transfer.

Let me know if any of you have faced similar problem and the work around
if any.

Thanks in advance.