Skip to content

win32: Add Input/OutputStream support for regular files

Or, "disk files" as they're called in Microsoft parlance.

We already supported HANDLEs representing sockets, named pipes, etc. However, when reading/writing a regular file the same asynchronous way, i.e. through the OVERLAPPED API, the file position to read/write at must be specified through the OVERLAPPED being passed in.

This is a subtle difference between ReadFile()/WriteFile() used in their synchronous mode vs asynchronous mode (OVERLAPPED). The former uses the HANDLE's current position and updates it after a succesful call, whereas the latter requires it to be passed in and managed externally. The latter is how we are using them, which means before this change we would keep reading/writing at the start of the file over and over, not making any progress.

Edited by Ole André Vadla Ravnås

Merge request reports