Thread overview
[Issue 14469] file.readText on Win64 doesn't work for files > 4GB.
Apr 21, 2015
Kenny Alive
Apr 21, 2015
Kenny Alive
April 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14469

--- Comment #1 from Kenny Alive <artemalive@gmail.com> ---
Additionally since ReadFile (and ReadFileEx too) can read file in chunks not larger than 4GB the file reading code should be updated to something like this:

            ulong totalNumRead = 0;
            while (totalNumRead != size)
            {
                uint chunkSize = (size - totalNumRead) & 0xffffffff;
                DWORD numRead = void;
                cenforce(ReadFile(hFile, cast(ubyte*)lpBuffer + totalNumRead,
chunkSize, &numRead, null) != 0
                        && numRead == chunkSize, name);
                totalNumRead += chunkSize;
            }

--
April 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14469

--- Comment #2 from Kenny Alive <artemalive@gmail.com> ---
The above algorithm for reading file has a bug. chunkSize should be calculated like this:

uint chunkSize = min(size - totalNumRead, 0xffffffff);

--
May 25, 2015
https://issues.dlang.org/show_bug.cgi?id=14469

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/95fd043dc6d0c945c171f8874761e1399a11252c Fix Issue 14469 - read > 4GB file on Windows x64.

https://github.com/D-Programming-Language/phobos/commit/75f068773ccc0750c2cf865fe2f621a9947723f3 Merge pull request #3218 from artemalive/issue_14469

Fix Issue 14469 - read > 4GB file on Windows x64.

--
May 25, 2015
https://issues.dlang.org/show_bug.cgi?id=14469

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
July 19, 2017
https://issues.dlang.org/show_bug.cgi?id=14469

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to dmd-cxx at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/95fd043dc6d0c945c171f8874761e1399a11252c Fix Issue 14469 - read > 4GB file on Windows x64.

https://github.com/dlang/phobos/commit/75f068773ccc0750c2cf865fe2f621a9947723f3 Merge pull request #3218 from artemalive/issue_14469

--