Skip to content

Cannot use windows oibc to receive a file #19

@jbry

Description

@jbry

ReceiveFile on the window oibc will deadlock.

The function is written in a way that appears to always make that happen (that or a lucky race condition before stopped it).

There are several issues:

  1. After using ReadFile with the overlapped flag set, GetOverlappedResult should be used to check how many bytes were read, as the parameter will always come back 0. (This can also be used instead of WaitForSingleObject)
  2. EnterCriticalSection for gReadSection seems to be entered before WriteFile is called. The gReadSection is locked by waiting for the device to output some information, this of course won't happen as it is sitting idly. The EnterCriticalSection should be moved after the WriteFile
  3. WriteFile and ReadFile in receiveFile both need to have the &rfOverlapped parameter added to them, otherwise you will get an error
  4. sprintf when building the receivefile command, %ul is not a valid token (VS2010 C++ express at least)

The rest of it seems to work fine

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions