fix #8678, reading large files on windows

read() on windows takes a uint, so apply a similar io limit per call
as done on mac (directly reusing the same code would give a compiler
warning, since long is 32 bits on windows)

(cherry picked from commit 46e15987e0fb0c3d8f20b791252ab6846df90ceb)
ref #8689