FreeRDP/FreeRDP — Issue #487: RDPDR: Disk Redirection failing with large files > 2GB
Author: Nigel62
Created: 2012-03-07 11:55:40+00:00
State: open

I found that rdpdr fails to handle files >2GB in size. Directory lists show their size as negative, copying files to and from the server also fails. (2008R2 sp1)

It seems it's down to the file handle routines, open, stat, lseek etc are not using the 64-bit counterparts, additionally, open seems to need the O_LARGEFILE flag to succeed.

I'm building on an Ubuntu 10.4 platform, gcc version:gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

Adding the following prior to inclusion of sys/stat.h seems to overcome the issue
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
together with the use of stat64() & lseek64() to the disk_file.c

I'm happy to check these changes in, but am unsure if this will have an adverse effect on other platforms