Windows: Support reading files larger than 4GB

We have three implementations of low-level file reading, meant to eliminate the potential overhead of C++ file streams.

The POSIX implementation appears to already be written in a way that on sensible implementations, 64-bit offsets will be properly used. So Linux, macOS and Android should already be set. Probably.

stdio implementation by design (language spec) cannot support files larger than 2GB. While this may sound concerning, the affected platforms (non-Windows, non-*nix) are rather obscure and are probably not supported by us. So it's probably unimportant.

Which brings us to the most commonly used implementation: the one for Windows. win32 implementation uses Windows API in a way that it cannot properly use offsets beyond 4GB, and might fail earlier depending on how the API is used.
Since we can read BA2 archives now and BA2 use 64-bit offsets and can easily be larger than 4GB (e.g. official Starfield files), we'll probably want to support files larger than that.

I investigated this recently and theoretically doing this should be enough:

  • size should use GetFileSizeEx
  • tell can be reimplemented as seek(handle, 0, SeekType::Current)

There's of course the alternative of investigating whether it's possible to get fstream to be any faster than it was in 2014, but that's considerably more involved.