I've opened a file with CreateFile
and passed that handle into both GetFileSizeEx
and SetFilePointerEx
which can both be used to get the file size. I then need to use ReadFile or ReadFileEx to read in the data from the whole file into a buffer.
The problem I'm having is that GetFileSizeEx
and SetFilePointerEx
both provide the file size as a LARGE_INTEGER type but ReadFile takes a DWORD for the number of bytes to read. Is there some workaround for this?
CreateFileMapping()
andMapViewOfFile()
to map a memory pointer to the file data.CreateFileMapping()
supports files more than 4GB, and on 64bit WindowsMapViewOfFile()
can access more than 4GB of data at a time. Though, you really shouldn't be using that much sequential memory at one time to begin with, even with a user allocated buffer. There are better ways to work with large amounts of data using smaller amounts of memory. – Remy Lebeau