large file support in Win32

Alaric Dailey alaricd at pengdows.com
Thu Sep 22 15:21:50 CEST 2005


GetFileSize shouldn't be the API call you are making you should be using 
GetFileSizeEx, but...

DWORD GetFileSize (HANDLE hFile, LPDWORD pHighOrder)

it returns a low order unsigned long, and if you want the larger portion 
you need to pass in a pointer to a DWORD to get the HIGH ORDER portion 
of the file size (greater than 4Gig).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfilesize.asp


Ryan Malayter wrote:
> Looking at the PLatform SDK documentation, it isn't clear that
> GetFileSize will fail when a file is > 4 GB. Maybe I'm reading it
> incorrectly, and it is certainly very vague, but nowhere does it say
> "if a file is greater than 4 GB, INVALID_FILE_SIZE will be returned".
> It only sayd about "if the function fails", not that a file size > 4GB
> will cause it to fail.
>
> I suppose the only thing to do would be to pass a lpFileSizeHigh value
> and test combinations with GetLastError to see what the function's
> behavior really is.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp
>
>
> On 9/22/05, Werner Koch <wk at gnupg.org> wrote:
>   
>> On Wed, 21 Sep 2005 22:47:10 -0500, Ryan Malayter said:
>>
>>     
>>> 09/18/2005 05:44 AM 45,284,360,192 myfile.bkf
>>>       
>>> :literal data packet:
>>>  mode b (62), created 1127307875, name="myfile.bkf",
>>>  raw data: 2334687232 bytes
>>>       
>> This number is exactly the remainder of 45284360192 / 2^32.
>>
>> Thus my conclusion is that GetFizeSize does not return a proper error
>> as ist should according to the documentation. Maybe this did not
>> happen with W98.
>>
>> The easiest way of fixing it would be using GetFileSizeEx but that
>> function is only available with W2000 Professional. So either I try to
>> figure out why GetFileSize does not return an error anymore or I need
>> to dynamically load GetFileSizeEx; did the later at other places too.
>>
>> Many thanks for running this test.
>>
>>  Werner
>>
>>
>>     
>
>
> --
>    RPM
> =========================
> All problems can be solved by diplomacy, but violence and treachery
> are equally effective, and more fun.
>       -Anonymous
>
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel
>
>   



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3544 bytes
Desc: S/MIME Cryptographic Signature
Url : /pipermail/attachments/20050922/d8751d1b/smime.bin


More information about the Gnupg-devel mailing list