[erlang-questions] : efile_drv.c bug?

Raimo Niskanen <>
Wed Jun 18 09:01:00 CEST 2008


On Tue, Jun 17, 2008 at 11:08:02AM -0700, Jim McCoy wrote:
> > 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...

Most decent mail clients can be configured to use the list
address in the To: field for replies to mailing lists.

> 
> What I send to Darren was the following:
> On Mon, Jun 16, 2008 at 1:10 PM, Darren New <> 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.

Thanks a lot! I will have a look at it and investigate
if there are backwards compatibility issues when using the
nFileSizeHigh field or with other API functions win_efile.c
uses. Apart from that it sounds like an easy enough fix.

> 
> jim
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list