[Mingw-users] MinGW ReadFile

Back to archive index
Eli Zaretskii eliz****@gnu*****
Tue Dec 18 01:02:20 JST 2018


> From: Kat <Kaz****@t-tec*****>
> Date: Mon, 17 Dec 2018 16:48:21 +1030
> 
> I support legacy software that uses MinGW. I have been experiencing an 
> interesting issue on a specific computer. Only happens on that computer. 
> It runs Windows 7 64 bit.

First, are you running mingw.org's MinGW, or the MinGW64 fork (which
can produce 64-bit binaries)?  If the latter, this is the wrong list
to ask about this problem.

> I send a command via WriteFile to a device. This works just fine. The 
> device then starts returning data in multiple packets which I read 
> asynchronously using ReadFile(). I can use big hefty sleeps to prevent 
> access to the buffer during input. The corruption still happens.
> 
> On all computers running Windows 10 this works fine.
> 
> On this specific computer, some of the first bytes of a packet (I've 
> never seen it happen to the first packet) becomes corrupted.
> 
> ****
> 
> The only thing I can think of is that the ReadFile call itself is 
> somehow corrupting the data as it comes in (sometimes). Is this possible?

I think you didn't tell enough details to answer that question.  The
code that opens the file/device and reads from it, as well as a few
examples of the corruption would be the minimum information to begin
thinking about this.  Perhaps also consider to describe your
asynchronous reading arrangement in more detail.

> Since I use MinGW, I thought I would ask here first.

Actually, ReadFile and WriteFile are _not_ MinGW, they are Win32 API
functions implemented by Windows itself.



More information about the MinGW-Users mailing list
Back to archive index