FILE_FLAG_NO_BUFFERING read operations don't work correctly
A Linux ext2/ext3 file system driver for Windows
Brought to you by:
matt_wu
Try to read file with size 524288(0x80000) bytes
by this code
int wmain(int argc, wchar_t ** argv)
{
const DWORD size = 524288;
HANDLE h = ::CreateFileW(L"some-file-with-size-524288", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
if (h == INVALID_HANDLE_VALUE)
{
std::cerr << "Failed to open file\n";
return 1;
}
BYTE buf[size];
DWORD read;
BOOL res;
for(int i = 0; i != 3; ++i)
{
res = ::ReadFile(h, buf, size, &read, NULL);
std::cout << res << ' ' << read << ' ' << GetLastError() << "\n";
}
}
Program writes
1 524288 0
1 524288 0
1 524288 0
but
1 524288 0
1 0 0
1 0 0
is expected
Internal fileoffset was not updated for noncached i/o. Fixed in 0.60.