[erlang-questions] efile_drv.c bug?
Jim McCoy
jim.mccoy@REDACTED
Tue Jun 17 20:08:02 CEST 2008
> In private mail (likely mistakenly sent to me instead of the list ;-)
> I'm told it's because Windows in its structures represent file sizes as
> two 32-bit integers, and the code just doesn't compensate properly.
Grrr... that nasty default reply-to...
What I send to Darren was the following:
On Mon, Jun 16, 2008 at 1:10 PM, Darren New <dnew@REDACTED> wrote:
> Any idea why Windows (XP/SP2/32bit) can't handle files >4G but Linux can
> with the same release? Is this something expected to get fixed eventually?
The win32 api has a funky way of dealing with file sizes for large
files (retrofitting a 32bit api for files that have a size in excess
of 2^32 I guess :) and Erlang's windows file driver does not support
this.
The problem code is in erts/emulator/drivers/win32/win_efile.c in the
efile_openfile function. It calls GetFileInformationByHandle to get
the file info, but it only returns the nFileSizeLow data. What it
needs to do is to also grab the nFileSizeHigh data, shift it 32 bits
left into a long and then add (nFileSizeLow & 0xFFFFFFFF) to that
result.
jim
More information about the erlang-questions
mailing list